[Issue 14519] [Enh] foreach on strings should return replacementDchar rather than throwing

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Apr 29 10:41:28 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14519

--- Comment #22 from Marc Schütz <schuetzm at gmx.net> ---
(In reply to Vladimir Panteleev from comment #20)
> (In reply to Marc Schütz from comment #18)
> > Data with other (or unknown) encodings needs to be stored in `ubyte[]`.
> 
> Have you tried using ubyte[] to process ASCII text? It's horrible, you have
> to cast at every step, and nothing in std.string works even when it should.

For ASCII text, char[] is okay, UTF8 is a superset of ASCII.

But you're right for other encodings. That's why those need to be converted "at
the border": To UTF8 when read from a file or stdin, main() args, env vars, and
from UTF8 to whatever on writing. Internally, they need to be UTFx encoded.
This is the only sane way to handle different text encodings, IMO.

--


More information about the Digitalmars-d-bugs mailing list