on-internet
← Community

What's the rationale for UTF-8 to store the code point directly?

Stack Overflow ·

UTF-8 stores the significant bits of the code point in the low bits of the code units U+0000-U+007F 0xxxxxxx U+0080-U+07FF 110xxxxx 10xxxxxx U+0800-U+FFFF 1110xxxx 10xxxxxx 10xxxxxx U+10000-U+10FFFF 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx That requires the decoder to check for over long sequences (like C0 80 instead of 00) and also reduces the number of code points encodable up to a fixed number of bytes. If it uses the same encoding but maps the code points like this First 128 code points (U+0000—U+007F): 1 byte Next 2048 code points (U+0080—U+087F): 2 bytes. E.g. C0 81: U+0081 Next 65536 code po

Comments

Sign in or sign up to comment and upvote.

No comments yet.