Why is utf8 the default in D?

Christopher Wright dhasenan at gmail.com
Mon Apr 27 04:23:27 PDT 2009


Frank Benoit wrote:
> M$ and Java have chosen to use utf16 as their default Unicode character
> encoding. I am sure, the decision was not made without good reasoning.
> 
> What are their arguments?
> Why does D propagate utf8 as the default?

Unicode did not match ISO10646 when Java and Windows standardized on 
UTF-16. At the time, the choices were UTF-8 and UTF-16. UTF-16 made 
internationalization easier than UTF-8 with a relatively small overhead.

As for UTF-8 being the default in D, that's a library issue. I think 
Tango uses templates and overloads to allow you to use char[], wchar[], 
and dchar[] most of the time.

> E.g.
> Exception.msg
> Object.toString()

Object.toString and Exception.msg are meant to be used for debug output.

> new std.stream.File( char[] )

It should not be too hard to fix this; you can write a bug report asking 
for overloads.



More information about the Digitalmars-d mailing list