Wide characters support in D

Walter Bright newshound1 at digitalmars.com
Mon Jun 7 19:22:00 PDT 2010


Ruslan Nikolaev wrote:
> Just one more addition: it is possible to have built-in function that
> converts multibyte (or multiword) char sequence (even though in my proposal
> it can be of different size) to dchar (UTF-32) character. Again, my only
> point is that it would be nice to have something similar to TCHAR so that all
> libraries can use it if they choose not to provide functions for all 3 types.
> 
> 
> 2Walter: Yes, programmers do often ignore surrogate pairs in case of UTF-16.
> But in case of undetermined char size (1 or 2 bytes) they will have to use
> special builtin conversion functions to dchar unless they want their code to
> be completely broken.

The nice thing about char[] is that you'll find out real fast if your multibyte 
code is broken. With surrogate pairs in wchar[], the bug may lurk undetected for 
a decade.


More information about the Digitalmars-d mailing list