← Back to index
|
Original Bugzilla link
Bug 11068 – raw formatting of chars and strings is wrong
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-19T00:24:00Z
Last change time
2013-09-19T18:55:50Z
Keywords
pull
Assigned to
monarchdodra
Creator
monarchdodra
Comments
Comment #0
by monarchdodra — 2013-09-19T00:24:40Z
//---- foreach(C ; TypeTuple!(char, wchar, dchar)) { auto app = appender!string(); formattedWrite(app, "[%r] [%r]", cast(C)'a', to!(const(C)[])("aa")); writefln("[%(%x, %)]", app.data().representation()); } //---- //What I expected [5b, 61, 5d, 20, 5b, 61, 61, 5d] [5b, 61, 0, 5d, 20, 5b, 61, 0, 61, 0, 5d] [5b, 61, 0, 0, 0, 5d, 20, 5b, 61, 0, 0, 0, 61, 0, 0, 0, 5d] //What I got [5b, 61, 0, 0, 0, 5d, 20, 5b, 61, 61, 5d] [5b, 61, 0, 0, 0, 5d, 20, 5b, 61, 61, 5d] [5b, 61, 5d, 20, 5b, 61, 61, 5d] //---- foreach(C ; TypeTuple!(char, wchar, dchar)) { auto app = appender!string(); formattedWrite(app, "%r", to!(const(C)[])("日本語")); writefln("[%(%x, %)]", app.data().representation()); } //---- //What I expected [e6, 97, a5, e6, 9c, ac, e8, aa, 9e] //9 UTF code units [e5, 65, 2c, 67, 9e, 8a] //3 2-Byte code units [e5, 65, 0, 0, 2c, 67, 0, 0, 9e, 8a, 0, 0] //3 4 byte code units //What I got. [e5, 65, 0, 0, 2c, 67, 0, 0, 9e, 8a, 0, 0] [e5, 65, 0, 0, 2c, 67, 0, 0, 9e, 8a, 0, 0] [e5, 65, 0, 0, 2c, 67, 0, 0, 9e, 8a, 0, 0]
Comment #1
by k.hara.pg — 2013-09-19T18:54:28Z
https://github.com/D-Programming-Language/phobos/pull/1588
Comment #2
by github-bugzilla — 2013-09-19T18:54:42Z
Commit pushed to master at
https://github.com/D-Programming-Language/phobos
https://github.com/D-Programming-Language/phobos/commit/2d7fc3d5d6a6b29d0c1aff1cb5365f247e25b68d
Merge pull request #1588 from monarchdodra/formatRaw Fix Issue 11068 - raw formatting of chars and strings is wrong