5 ms·
UTF-8 was also designed under rather severe restrictions: you want to keep binary compatibility with 7-bit ASCII, i.e. 128 out of 256 possible byte values are t
by Asooka 10y ago
UTF-8 was also designed under rather severe restrictions: you want to keep binary compatibility with 7-bit ASCII, i.e. 128 out of 256 possible byte values are taken and you want to encode the entirety of Unicode including any future additions. This means you need variable-length encoding. You also want to detect if the stream is well-formed and you want to detect if you're starting decoding in the middle of a character. UTF-8 is one of very few possible solutions that cover all requirements.
BGP had a lot more to work with since you're designing an entire protocol that doesn't need any backwards compatibility with anything else.
- barrkel 10y ago> You also want to detect if the stream is well-formed and you want to detect if you're starting decoding in the middle of a character These are positive characteristics of the UTF-8 design, but weren't necessary pre-requisites. Other encodings don't have the same redundancy (for integrity check) or freedom from boundary ambiguity.