3 ms·
> Because it depends on string encoding to define length. Let's say you have a UTF-8 string that stores emoji, what would the length be? The encoded length. Fi
by masklinn 4y ago
> Because it depends on string encoding to define length. Let's say you have a UTF-8 string that stores emoji, what would the length be?
The encoded length. First because it’s necessary, second because it’s C and would not bother with anything else, third because USV length is useless, fourth because grapheme clusters have dependencies on the locale and data files, and are only useful in some cases. And their relation with code units / USVs is irregular (adding USVs can decrease GCs).