[Issue 12616] New: AssertError in std.utf.decode
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Apr 22 12:54:18 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12616
Issue ID: 12616
Summary: AssertError in std.utf.decode
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: dmitrycvet at gmail.com
Created attachment 1347
--> https://issues.dlang.org/attachment.cgi?id=1347&action=edit
Frament of torrent file with bug (binary data)
I use std.utf.validate to check validity string of UTF. And i catch
UTFException if string not valid. But... In debug mode i have AssertError:
core.exception.AssertError at std.utf(950): Assertion failure
My code:
try {
root.str = cast(string) store.str; // from immutable(ubyte)[]
validate(root.str);
} catch(UTFException e) {
root.str = toHexString!(LetterCase.upper)(store.str);
}
It work on release mode.
--
More information about the Digitalmars-d-bugs
mailing list