3 ms·
UTF-16 is not harmful, just the "I use UTF-16, so I don't have to worry about Unicode issues anymore" stance is harmful. Processing text is hard. For example i
by perlgeek 15y ago
UTF-16 is not harmful, just the "I use UTF-16, so I don't have to worry about Unicode issues anymore" stance is harmful.
Processing text is hard. For example if you write an editor, you must be aware of things like right-to-left text sequences, full-width characters and graphemes composed of multiple codepoints.
If you implement a case insensitive search, you must be aware of title case, and the nasty German ß which case-folds to two upper-case characters (SS). (Ok, you'll probably just use regexes, it's the author of the regex engine who has to worry about it. And it is ugly, because it means that character classes can match two characters, which you have to consider in all length-based optimizations).
In first approximation it doesn't matter if you implement your stuff in UTF-8 or in one of the UTF-16 encodings, you have to deal with the same issues (include variable byte length for a single codepoint).