3 ms·
I 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.
by heinrich5991 12y ago
I 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.