D Conference Tango Phobos

Regan Heath regan at netmail.co.nz
Fri Sep 14 08:57:52 PDT 2007


Steven Schveighoffer wrote:
> "Regan Heath" wrote
>> Steven Schveighoffer wrote:
>> The good thing about UTF-8 is that it does not depend on locale.  UTF-8 in 
>> one locale is identical to UTF-8 in another.  It therefore does not imply 
>> any particular language either.
>>
>>> Not something I wish to do when I'm probably only going to use toUtf8 as 
>>> a debugging mechanism :)
>> I can understand that, and that's the beauty of UTF-8, 16, and 32 they can 
>> all represent any character anyone could possibly want to use independant 
>> of locale or language.
> 
> Thank you for the explanation, I totally understand now :)

No problem.  This is one of the things I love about the D news groups. 
When I first arrived I didn't know squat about Unicode, UTF-8, etc. 
Another D user, Arcane Jill, helped me understand.

For anyone interested I rekcon wiki has a great explaination of the UTF 
encodings:
http://en.wikipedia.org/wiki/UTF-8
http://en.wikipedia.org/wiki/UTF-16
http://en.wikipedia.org/wiki/UTF-32

> BTW, I still prefer toString :)

Same here.

> Perhaps to clarify that toString is not returning a tango.text.String, maybe 
> tango.text.String could be changed to tango.text.Utf8String? ;)  I see 
> myself using toUtf8 way more than using tango.text.String, so I'd rather 
> have the annoyance there.

I can understand the desire to avoid the confusion which would no doubt 
occur having Object.toString returning char[] in a library where a 
String class existed.

Disclaimer:  I haven't yet delved into Tango and actually used it for 
something, so I may have no idea what I'm talking about here next...

I suspect the initial motivation for tango.text.String was to provide an 
invariant string type?  and perhaps to bind member functions to the 
string type?

So.. assuming we get a const which provides invariant char[] arrays and 
can call any function of the form R func(A) in the form A.func then is 
there any need for tango.text.String any more?  (aside from the fact 
that it's probably used everywhere)

Regan



More information about the Digitalmars-d mailing list