What's left for 1.0? - string class

Bill Baxter wbaxter at gmail.com
Fri Nov 17 04:15:10 PST 2006


Samuel MV wrote:
> This is *very* serious for i18n:
> 
>  >>         char[] foo = "hög";
>  >>         assert(foo.length == 3); // Sorry UTF-8, this is == 4
>  >>         assert(foo[1] == 'ö');   // Not a chance!
> 
> char[] should be a real char[], not a sort of byte[] for text. It needs 
> to be fix for non-english.

That's what wchar and dchar are for.  If all you want is to make sure 
your chars are chars, then use dchar everywhere and be happy.  Just be 
aware that dchars are 32bits a piece.  Not a big deal for most apps, but 
could be for a few.

Is there any problem with dchar other than just the size of it being 
massive overkill for western languages?

--bb



More information about the Digitalmars-d mailing list