might be a bug in the DMD FrontEnd

Deewiant deewiant.doesnotlike.spam at gmail.com
Fri Mar 30 05:17:52 PDT 2007


Daniel Keep wrote:
>> foreach( dchar c ; some_string )
>> {
>>     // ...
>> }
> 
> Would *not* work correctly with the above if your string contains
> anything outside of the ASCII range.  Yes, the functions might work with
> non-UTF-8 codepages, but that's more a side-effect of how they are
> implemented.

True. But it's hard to implement (some of) them _without_ supporting non-UTF-8.
<g> And there's always the C standard library.

> I think what Phobos really needs is a character encoding conversion
> library, even if it's just a paper-thin binding to iconv or something.
> 

The problem is that you often aren't told the encoding, and have to work with
just bytes. You can guess (and I'm sure some pretty smart heuristics have been
developed for this), but it's not perfect, and you still need ASCII whitespace
stripping to work, regardless of the encoding.*

* Okay, so if the 0-127 range isn't ASCII, it won't work, but that's practically
nonexistent these days (at least on the platforms DMD supports).



More information about the Digitalmars-d mailing list