3 ms·
> who knew "sort these names alphabetically" could be an ambiguous statement That already is ambiguous without considering text encodings or even computers. S
by Someone 5y ago
> who knew "sort these names alphabetically" could be an ambiguous statement
That already is ambiguous without considering text encodings or even computers.
Sort order depends on locale (example, “in Lithuanian, "y" is sorted between "i" and "k"”) and within some locales even on the goal of the sorting (example: “in German dictionaries, "öf" would come before "of". In phone books the situation is the exact opposite.”
(Both examples taken from https://unicode-org.github.io/icu/userguide/collation/ https://unicode-org.github.io/icu/userguide/collation/, which has many more examples)
Also, on that “one code point in unicode does not necessarily map to one character on the screen”, I think it’s important to use consistent terminology. The screen doesn’t show characters but glyphs.
- Mlller 5y ago> in German dictionaries, "öf" would come before "of". I am only aware of “of” before “öf”, e.g. in Grimmʼs dictionary, the greatest dictionary of German itself, “offen” ‘open (adj.), openly’ comes before “öffen”, a variant of “öffnen” ‘to open’. When I have to sort strings in German, I make a sortstring by throwing out diacritics (via Unicode Normal Form “K”anonical Decomposition) and changing “ß” to “s”. Then I order by a tuple of this sortstring and the original string.
- bruce511 5y agoThis is exactly my point. Growing up I thought alphabetical order was pretty sorted, then I grew up, and discovered that not only are there more characters, but people don't even agree on the _ordering_ of characters. Thus alphabetical order becomes ambiguous depending on where you are. _then_ you discover some symbol sets / languages don't have an order at all. Oh the world is complicated. I wish I was 4 again.
- Ekaros 5y agoAnd then you come across dictionary or like and discover that yeah, sometimes things aren't sorted as strings, but weird things are done. Like "the" word, or person with some titles... While ofc. the title itself is sorted in that position...