logoalt Hacker News

Dwedittoday at 7:12 AM3 repliesview on HN

FF bytes are an easy way to identify an invalid UTF-8 file. This idea doesn't have that property.


Replies

sphtoday at 7:15 AM

True, but not all non-UTF8 bytestrings contain 0xFF bytes, so it’s not very useful in practice.

show 1 reply
flohofwoetoday at 7:26 AM

It's still a joy to see how frigging elegant and extensible the UTF-8 specification is. And even without the esoteric 0xFF lead byte, the regular UTF-8 encoding with a 0xFE lead byte (11111110) would still have plenty of headroom (36 bits) compared to the current 21 bits for UNICODE.

beeforporktoday at 8:11 AM

As are FE, FD, FC, FB, FA, F9, F8, F7, F6 and F5.