[Issue 15888] New: std.format generates broken hex strings for wchar[] and dchar[] with invalid values
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Apr 6 12:21:04 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=15888
Issue ID: 15888
Summary: std.format generates broken hex strings for wchar[]
and dchar[] with invalid values
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: ag0aep6g at gmail.com
----
void main()
{
import std.stdio: writeln;
ushort[] a = [0xFF_FE, 0x42];
writeln([cast(wchar[]) a]);
uint[] b = [0x0F_FF_FF_FF, 0x42];
writeln([cast(dchar[]) b]);
}
----
Prints:
----
[x"FFFE 42"w]
[x"FFFFFFF 42"d]
----
Should print something like this:
----
[x"FEFF 4200"w]
[x"FFFFFF0F 42000000"d]
----
Or, since endianess matters:
----
[[wchar(0xFFFE), 0x42]]
[[dchar(0xFFFFFFF), 0x42]]
----
Mind issue 15887, though.
--
More information about the Digitalmars-d-bugs
mailing list