10 ms·
Don't forget RFC4042, which defines UTF-9 and UTF-18.
by kps 3y ago
Don't forget RFC4042, which defines UTF-9 and UTF-18.
- skissane 3y agoSadly, both UTF-9 and UTF-18 are poorly designed. If you look at the structure of UTF-8, it is based on a prefix code: each byte starts with a string of 1s followed by a 0, where the total number of bytes in the sequence is the number of initial 1 bits in the first byte – except for single-byte sequences, which start with a 0 bit, and the 10 prefix instead of being used to introduce single byte sequences is instead used to mark continuation bytes. There is no reason why UTF-9 could not have adopted the same structure – 0xxxxxxxx for U+0000 thru U+00FF, 110xxxxxx 10yyyyyyy for U+0100 thr thru U+1FFF, etc, but instead the UTF-9 author decided to go with a much more simplistic scheme of "initial bit is 0 for initial byte, 1 for continuation byte". UTF-18 is also flawed, because it has no concept of surrogates, hence it cannot represent the full 21-bit repertoire of Unicode characters. Once again, there is no technical reason why it could not have supported the use of surrogates to achieve this. I suppose it doesn't really matter because it was just an April Fool's joke not a serious proposal – but if one was to make a serious proposal for a UTF-9 and UTF-18, I think it would have to fix these two flaws in RFC4042.