What's left for 1.0? - string class

Samuel MV samuel at jxdesigner.com
Fri Nov 17 04:36:24 PST 2006


Yep, memory is cheap, but then libraries has to support well 
char/wchar/dchar (quite unusual) ...

I think that there should be only one kind of char, that internally 
works as UTF8, UTF16 or UTF32 (automatically or on demand), but you 
don't care about it except when you need to interface with non-D 
libraries, files, etc. (solved with a couple of functions)

Best Regards,

                 Samuel.


Bill Baxter escribió:
> 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