Why the hell doesn't foreach decode strings

so so at so.so
Fri Oct 21 14:57:14 PDT 2011


On Fri, 21 Oct 2011 21:11:14 +0300, Peter Alexander  
<peter.alexander.au at gmail.com> wrote:

> Of course, people will still need to understand UTF-8. I don't think  
> that's a problem. It's unreasonable to expect the language to do the  
> thinking for you. The problem is that we have people that *do*  
> understand UTF-8 (like the OP), but *don't* understand D's strings.

Indeed, if one knows/understands how unicode works AND knows the structure  
of D strings, the current scheme is the best of both worlds.

foreach(e; string) // chars
foreach(e; byUTFxxx(string)) // ...


More information about the Digitalmars-d mailing list