[Issue 15882] writeln on a bad dstring triggering assert(0) in std.utf.toUTF8
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Apr 6 12:26:04 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=15882
ag0aep6g at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |WORKSFORME
--- Comment #4 from ag0aep6g at gmail.com ---
Seems like phobos is ahead of us here.
----
void main()
{
uint[] a = [0x8DA0000, 0x051B5A8, 0x67, 0x69, 0x74, 0x65, 0x63, 0x68];
import std.stdio: writeln;
writeln(cast(dchar[]) a);
}
----
Compiled with the freshly released dmd 2.071.0, this prints "��gitech", i.e. it
uses replacement characters now.
I think this is part of a change in the stance regarding invalid
char/wchar/dchar values. There used to be a guarantee/requirement that they do
not occur. Apparently, that has been given up in favor of a more forgiving
approach.
Since in dmd 2.071.0 it's working as you suggest, I'm closing this as
RESVOLED:WORKSFMORME. Feel free to reopen if I missed anything.
By the way, the generated hex string is broken. There should be lots of zero
bytes. I've filed a separate issue for that: issue 15888.
--
More information about the Digitalmars-d-bugs
mailing list