toString vs. toUtf8
Gregor Richards
Richards at codu.org
Mon Nov 19 16:30:51 PST 2007
Sean Kelly wrote:
> Walter Bright wrote:
>> Phobos (and D) has undergone some evolution in the thinking about
>> unicode strings, and it certainly has a few anachronisms in its names.
>> But I think we've evolved to the point where going forward, we know
>> what to do:
>>
>> char[] => string
>> wchar[] => wstring
>> dchar[] => dstring
>>
>> These are all unicode strings. Putting non-unicode encodings in them,
>> even temporarily, should be discouraged. Non-unicode encodings should
>> use ubyte[], ushort[], etc.
>
> This seems fair. It would reinforce the idea that strings really do use
> a common encoding format, and that foreign encodings are relegated to a
> different form of transport. Now if only toWString didn't look so
> horrible :-)
>
>
> Sean
Worse looking than toUtf16? Would you prefer if int => int32, long =>
int64, short => int16, byte => int8, real => float80 (portability be
damned), double => float64, float => float32? They'd certainly be more
obvious, but I can tell you I'd go crazy.
- Gregor Richards
More information about the Digitalmars-d
mailing list