UTF bug+proposed fix, please check

Timothee Cour via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 14 15:02:46 PDT 2014


I filed a bug report: https://issues.dlang.org/show_bug.cgi?id=12923 : "UTF
exception in stride even though passes validate"

and then a proposed fix. The fix still passes unittests and also solves the
bug, however I'm not sure whether it is correct: is the behavior of
strideImpl correct or is the old behavior of decodeImpl correct?

TL;DR:
auto fst=str.front;
immutable msbs = 7 - bsr(~fst);
if (msbs < 2 || msbs > 6) throw invalidUTF();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140614/314fe12f/attachment-0001.html>


More information about the Digitalmars-d mailing list