On Mar 14, 11 13:53, Jesse Phillips wrote:
KennyTM~ Wrote:

It is already throwing an exception called
core.exception.UnicodeException. This even provides you the index where
decoding failed.

(However Phobos is not using it, AFAIK.)

-----------
import core.exception, std.stdio, std.conv;

void main() {
      char[] s = [0x0f, 0x12,0x34,0x56,0x78,0x9a,0xbc];
      try {
          foreach (dchar d; s){}
      } catch (UnicodeException e) {
          writefln("error at index %s (%x)", e.idx, to!ubyte(s[e.idx]));
          // error at index 5 (9a)
      }
}
-----------

foreach does not use the range interface provided by std.array (that I know 
of). So there should be a bug reported on the current behavior of Access 
Violation.

I haven't checked on Windows, but there is no access violation in foreach (http://ideone.com/WSBRm), and there is no access violation in the range interface either (as of 2.052 it throws a std.utf.UtfException), so I don't know what bug you are talking about.

Reply via email to