Wide characters support in D

Walter Bright newshound1 at digitalmars.com
Mon Jun 7 16:18:32 PDT 2010


Ruslan Nikolaev wrote:
> Note: I posted this already on runtime D list,

Although D is designed to be fairly agnostic about character types, in practice 
I recommend the following:

1. Use the string type for strings, it's char[] on D1 and immutable(char)[] on D2.

2. Use dchar's to hold individual characters.

The problem with wchar's is that everyone forgets about surrogate pairs. Most 
UTF-16 programs in the wild, including nearly all Java programs, are broken with 
regard to surrogate pairs. The problem with dchar's is strings of them consume 
memory at a prodigious rate.


More information about the Digitalmars-d mailing list