toUTFz again

Jonathan M Davis jmdavisProg at gmx.com
Tue Mar 13 11:18:50 PDT 2012


On Tuesday, March 13, 2012 19:13:06 Andrej Mitrovic wrote:
> 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.

If a bug report doesn't exist for that, then create it. That's pretty much 
Kenji's territory, since it's std.conv, though I might take a wack at it at 
some point if he doesn't.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list