by Aardwolf · 2y ago · 0 comments
Somehow UTF-16 reserves some of those decoded integer values (instead of solving its whatever problem it had in its encoding itself)
The fact that UTF-8 didn't need to also destroy some output integer values to work proves it's not necessary to do that
Encoding and decoded value should be separate concerns
That's like having a mathematical encoding of integers that's like base 10, but for some reason you decide that integer values 100 to 110 are reserved and may never be used by anyone, not even other legit encodings like regular base 10
This property is not true of UTF-8 - if you get a byte-string with bytes between 0x80 and 0xFF, it might be UTF-8, or it might be one of a bunch of other encodings, you need to do a more involved check to be sure.
Granted, the presence of a value between 0xD800 and 0xDFFF does not guarantee that the text is UTF-16, that's why this "WTF-8" encoding exists. But confusion would be a whole lot more likely if the U+D800-U+DFFF range were not reserved.