4 ms·
I strongly question "doesn't require a validation pass". 1. Your code drops naked continuation bytes entirely. 2. If a valid multibyte character is followed b
by Dylan16807 6y ago
I strongly question "doesn't require a validation pass".
1. Your code drops naked continuation bytes entirely.
2. If a valid multibyte character is followed by extraneous continuation bytes it will not decode correctly.
3. Using the wrong number of continuation bytes is a giant mess and can give you arbitrary numbers in multiple ways.
The second one especially is a behavior that's hard to defend.