3 ms·
You can't get grapheme clusters but you can get actual codepoints by spreading a string into an array, ex [..."abc\uD83C\uDF08"] is ["a", "b", "c", "\u{1F308}"]
by easrng 4y ago
You can't get grapheme clusters but you can get actual codepoints by spreading a string into an array, ex [..."abc\uD83C\uDF08"] is ["a", "b", "c", "\u{1F308}"]
- kazinator 4y agoIf you carefully manipulate the array to produce some different array, and then convert back to string/text, you can preserve the grapheme clusters just fine. Just like the way string manipulating routines that don't know anything about Unicode can work with UTF-8 without breaking the text, simply by not truncating or separating the data in the middle of a UTF-8 sequence.