A character boundary is a position where user-perceived text can be divided safely. Java’s char values are not reliable character units: surrogate pairs, combining sequences, and ligature clusters may span multiple char values. Splitting by char index can therefore break an emoji, detach a modifier, or produce malformed user-readable text. section 6.1
Split text by character boundaries
For user-readable text, use BreakIterator rather than substring indexes: BreakIterator iterator = BreakIterator.getCharacterInstance(); iterator.setText(string); iterator.first(); int from = iterator.next(rowLength * rowNumber); int to = iterator.next(rowLength - 1); This recognizes surrogate pairs and keeps combining sequences or emoji modifiers together. section 6.1
Keep text-processing code isolated and prefer dedicated text APIs or ICU4J. For code-point-oriented operations that are not user-character operations, use int-based APIs such as codePointAt and avoid char-centric public interfaces. section 6.1
