4 ms·
UTF-16 has all of the disadvantages of UTF-8 and none of the advantages, and originally comes from the UCS-2 era where they thought, "64k characters are enough
by xpaulbettsx 15y ago
UTF-16 has all of the disadvantages of UTF-8 and none of the advantages, and originally comes from the UCS-2 era where they thought, "64k characters are enough for everyone!" Unfortunately, all of Windows uses it, so we as an industry are stuck with it.
- jensnockert 15y agoYou mean that it is not ASCII compatible? Also, Mac OS X, Java, .Net, Qt, ICU... there are a lot of support for UTF-16, for other reasons than backwards compatibility. Processing UTF-16 is easier in many situations.
- nitrogen 15y agoProcessing UTF-16 would only be easier if you have a valid byte-order mark and/or know the endianness in advance and you can guarantee that no surrogate pairs exist. Otherwise the same pitfalls exist as when processing UTF-8, plus the endianness issue and the possibility of UTF-16 programmers not knowing about surrogate pairs.
- xpaulbettsx 15y agoWhat you're describing is UCS-2, not UTF-16. That's why the latter is frustrating to deal with
- sp332 15y agoUTF-16 is not ASCII-compatible, if that's what you were asking.