4 ms·
Also another problem: UCS-2, commonly used as implementation for UTF-16, doesn’t support all the characters that UTF-8 does, which can lead to other nice probl
by kuschku 12y ago
Also another problem:
UCS-2, commonly used as implementation for UTF-16, doesn’t support all the characters that UTF-8 does, which can lead to other nice problems during conversion.
- vardump 12y agoThat's not true. Both UTF-16 and UTF-8 can encode any valid unicode code point.
- deleted 12y ago[deleted]
- MaulingMonkey 12y agoI suspect you're thinking of UCS-2 (UTF-16's precursor), not UTF-16 proper. Both UTF-8 and UTF-16 are variable length encodings capable of storing the entire unicode character set.
- kevin_thibedeau 12y agoUTF-16 covers the full Unicode space just like UTF-8. You're thinking of UCS-2 (limited to plane 0) as implemented by Windows.
- kuschku 12y agoWhich can create nice issues, especially because stuff like Java is limited to UCS-2...
- vardump 12y ago> Which can create nice issues, especially because stuff like Java is limited to UCS-2... Not true. Java uses UTF-16, not UCS-2. There are no encoding representation issues.
- heinrich5991 12y agoI believe strings in Java are not checked for UTF-16, but are just arrays of 16-bit integers and as such used as UCS-2 by most Java code.
- jerven 12y agoMost code written in the US/UK does not care about multiple codepoint used to represent one glyph. But that does not change the fact that the String representation inside Java are actually encoded in UFT-16 since Java1.5 (i.e. since 2004). Actually dealing with multi codepoint characters is hard in any programming language and most people ignore it as often GUI stuff already takes care of it. By the way any string encoded in UTF-16 is an array of 16bit unsigned integers. It just has variable length encoding which UCS-2 did not have. Just like UTF-8 is an array of bytes just like 8bit ASCII.