[Issue 17861] UTF Decode fails with exception

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 26 21:08:10 UTC 2017


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

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com

--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> ---
std.utf.decode accepts a parameter to allow for exactly what you ask:

import std.utf, std.typecons;

void main()
{
    size_t idx = 0;
    auto x = decode!(Yes.useReplacementDchar)("\xff", idx);
    assert(x == 0xfffd);
}

What is the actual use case you are using the druntime version for?

--


More information about the Digitalmars-d-bugs mailing list