Sorting names in several languages

Back to list2023-09-16
You

Alphabetical sort puts accented names at the end.

ChatGPT

Byte order is not alphabetical order. Use a locale-aware collator, and pick the locale deliberately, because Swedish and German disagree about where "รค" belongs and both are right for their readers.

You

len() disagrees with what users see as one character.

ChatGPT

Because a user-perceived character can be several code points: an emoji with a skin tone modifier is one grapheme and up to four code points. Count grapheme clusters when the number is shown to a person, code points when it is a storage limit.

You

Any downside worth knowing before I commit?

ChatGPT

It commits you to a format that is tedious to migrate away from later. The first weeks also look worse than doing nothing, which is when most people abandon it.