Why the hell doesn't foreach decode strings

Walter Bright newshound2 at digitalmars.com
Thu Oct 20 19:26:43 PDT 2011


On 10/20/2011 2:49 PM, Peter Alexander wrote:
> The whole mess is caused by conflating the idea of an array with a variable
> length encoding that happens to use an array for storage. I don't believe there
> is any clean and tidy way to fix the problem without breaking compatibility.

There is no 'fixing' it, even to break compatibility. Sometimes you want to look 
at an array of utf8 as 8 bit characters, and sometimes as 20 bit dchars. Someone 
will be dissatisfied no matter what.

There is no way to program strings in D without being aware of UTF-8 encoding.


More information about the Digitalmars-d mailing list