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: [email protected]
Reporter: [email protected]
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:
[email protected](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.
--