A surrogate pair is two Java char values that together represent one Unicode code point outside the Basic Multilingual Plane. Therefore, char-by-char processing and String.length() do not always match the characters users see. Many emoji require surrogate pairs. section 6.1
Splitting an emoji
A fixed-width substring can cut the pair for an emoji such as code point 0x1f601, leaving only � or �. The output may show a placeholder character instead of the emoji. Emoji with modifiers create a second boundary problem: a waving hand with a dark skin tone modifier occupies four Java chars, so a split can discard the modifier even when it avoids cutting either pair. section 6.1
Avoid treating UTF-16 code units as complete characters:
- For user-facing chunks, account for combining characters as well as surrogate pairs; BreakIterator can locate character boundaries. section 6.1
- Review abbreviations, row wrapping, and validation code for substring or charAt assumptions rather than relying on String.length(). section 6.1
