www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Fractal

reply Fractal <email server.com> writes:
Frits van Bommel Wrote:

 Fractal wrote:
 Jarrett Billingsley Wrote:
 Because those are the three string encodings D supports, and only
 supporting one is a dumb idea.

Why? wchar is full compatible with all languages (if it is not please tell me)... also when I have many strings in different types, I need to convert it from one type to other in each part of the program. Why three when one is suffice?

IIRC, Chinese characters can't be represented by a single wchar. However, that's not a problem since all three string types support full Unicode.
 are all Unicode, just different encodings.  However, even if you can
 throw an exception in Spanish, it might not print out correctly on
 Windows unless you have your console configured correctly.

Oh... I will take a look for that (console configuration)... but the char type dont supports some languages, because it only supports latin... Im wrong? The Exception on the two APIs uses char[]. I want Inernationalized programs.

char[] supports any language that wchar[] and dchar[] support. It's just that with char and wchar you need more than one of them for some characters. You may want to read http://prowiki.org/wiki4d/wiki.cgi?DanielKeep/TextInD and http://en.wikipedia.org/wiki/Unicode (or one of its many translations if your English is not so good).

Thanks for the correction... then adding a String struct to simplify it? Fractal
Jun 08 2009
parent reply Robert Fraser <fraserofthenight gmail.com> writes:
Fractal wrote:
 Thanks for the correction... then adding a String struct to simplify it?
 
 Fractal

Why? char[] _is_ a string. wchar[] and dchar[] are basically there for compatibility with libraries that want them. That being said, tango.text.Text is a "string struct" of a sort, although it's designed more for representing a large block of text in an editor rather than a single string. There's also mtext ( http://www.dprogramming.com/mtext.php ), though it's unlikely to compile without modification since it's rather old.
Jun 08 2009
parent Fractal <email server.com> writes:
Robert Fraser Wrote:

 Why? 

Because I want the same string handling that any modern language has, for every part of the program. just using String, not char[]. Then mystring[1] will return a dchar, and not something that cannot be understanded. Fractal
Jun 08 2009