Readit News logoReadit News
dbaupp commented on UTF-8 is a brilliant design   iamvishnu.com/posts/utf8-... · Posted by u/vishnuharidas
s1mplicissimus · 3 months ago
I was just wondering a similar thing: If 10 implies start of character, doesn't that require 10 to never occur inside the other bits of a character?
dbaupp · 3 months ago
UTF-8 encodes each character into a whole number of bytes (8, 16, 24, or 32 bits), and the 10 continuation marker is only at the start of the extra continuation bytes, it is just data when that pattern occurs within a byte.

You are correct that it never occurs at the start of a byte that isn’t a continuation bytes: the first byte in each encoded code point starts with either 0 (ASCII code points) or 11 (non-ASCII).

u/dbaupp

KarmaCake day10241January 17, 2012
About
http://huonw.github.io/
View Original