[Issue 6125] to!string doesn't throw on invalid UTF sequence

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Aug 27 14:55:57 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=6125

Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei at erdani.com

--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> ---
-----
import std.conv;
import std.stdio;

void main()
{
    auto x = to!string(cast(char)255);
    writeln(x);
}
-----

Outputs:
[Decode error - output not utf-8]

I think the to!() routines should be UTF safe so the call to to!string above
should throw an exception. Is this right Andrei?

--


More information about the Digitalmars-d-bugs mailing list