3 ms·
> Combining characters are their own unicode codepoint, so they count towards length. This is incredibly arbitrary - it depends entirely on what "length" means
by d110af5ccf 6y ago
> Combining characters are their own unicode codepoint, so they count towards length.
This is incredibly arbitrary - it depends entirely on what "length" means for a particular usecase. From the user's perspective there might only be a single character on the screen.
Any nontrivial string operation must be based around grapheme clusters, otherwise it is fundamentally broken. Codepoints are a useful encoding agnostic way to handle basic (split & concatenate) operations, but the method by which those offsets are determined needs to be grapheme cluster aware. Raw byte offsets are encoding specific and only really useful for allocating the underlying storage.