Original link: Java Unicode Guide: Handling Strings & Characters Correctly / TheMainThread.
Back when all Unicode characters had values that could be stored in 16 bit, then UTF-16 was a perfect in-memory encoding. That was the case when Java arrived in early 1996. But just a few month later Unicode 2.0 defined potentially more characters and the following versions used this ability.
And Java had to start distinguishing between characters or code points being either 1 or 2 chars (16 or 32 bits) and chars or code units always being 16 bit.
Which 90% of Java applications fail to do correctly.
The good thing is that the problematic characters are mostly rare language. But one exception exist: emojis.