toUTFz again

Andrej Mitrovic andrej.mitrovich at gmail.com
Tue Mar 13 11:13:06 PDT 2012


On 3/13/12, Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:
> I've completely lost track of what happened with the whole toUTF16z
> story

Btw, to!string still doesn't work with wchar* arguments. I currently
use this hack:

wstring fromUTF16z(in wchar* s)
{
    if (s is null) return null;
    wchar* ptr;
    for (ptr = cast(wchar*)s; *ptr; ++ptr) {}
    return to!wstring( s[0..ptr-s] );
}

and then this can be converted to UTF8 if needed. It would be great if
conv.to!() was improved in this regard.


More information about the Digitalmars-d-learn mailing list