D Conference Tango Phobos

Regan Heath regan at netmail.co.nz
Fri Sep 14 07:41:50 PDT 2007


Steven Schveighoffer wrote:
> To me, I think toString is more clear.  BTW, I think utf-8 has multi-byte 
> characters.  If that's the case, then isn't toASCII more appropriate?

Are you saying that the object to<whatever> routine should output ASCII 
and not UTF-8, 16, or 32?  If so, I doubt the japanese D community would 
agree. <g>

Yes, UTF-8 characters are multi-byte characters but it also a superset 
of ASCII.  As in, the ascii value of 'a' is the same in UTF-8 (and 
occupies a single byte).

I prefer the name 'toString' over 'toUtf8'.

I think that, given we have a 'string' type which is UTF-8, toString 
therefore implies UTF-8 also.

Also, most of the standard library expects you to be using UTF-8 (which 
may or may not be a good thing) so it seems to be the 
standard/common/default D character type/format.

That is despite the fact that many of the standard library routines use 
or convert to dchar to carry out their operations.

Regan



More information about the Digitalmars-d mailing list