Grapheme clusters, a.k.a.real characters
Rick Johnson
rantingrickjohnson at gmail.com
Sat Jul 15 10:08:12 EDT 2017
On Friday, July 14, 2017 at 2:40:43 AM UTC-5, Chris Angelico wrote:
> [...]
> What is the length of a string? How often do you actually
> care about the number of grapheme clusters - and not, for
> example, about the pixel width? (To columnate text, for
> instance, you need to know about its width in pixels or
> millimeters, not the number of characters in the line.)
Not in the case of a fixed width font!
> And if you're going to group code points together because
> some of them are combining characters, would you also group
> them together because there's a zero-width joiner in the
> middle? The answer will sometimes be "yes of course" and
> sometimes "of course not".
Consistency is the key. And we must remember that he who
assembled such inconsistent strings can only blame herself.
More information about the Python-list
mailing list