4 ms·
In a UTF-16 string, as implemented in java, you can end up with a char that represents only half a surrogate pair, that's not a full unicode scalar. In order t
by recursive 5y ago
In a UTF-16 string, as implemented in java, you can end up with a char that represents only half a surrogate pair, that's not a full unicode scalar. In order to build the unicode scalar, you need the other half of the surrogate pair, which is another java "char".
- camgunz 5y agoYeah this is probably true. I haven't checked it in repl.it, but my other experiments basically showed that UTF-16 as UCS-2 is fine, getting above 0xFFFF (bigger than a Java char) causes problems. It's really disappointing, honestly. Go has rune, which is 32-bit, and adding a new rune-based API seems doable. But hey, what do I know.