2026-09-07 22:32 UTC
:brain1: Sort names using strcasecmp()
:brain2: Family name first, elide spaces, hyphens, apostrophes, etc., treat “Mc” as “Mac”, skip “The”, “A”, “An”,
:brain3: I will simply use a collation algorithm. Surely someone has made a decent collation algorithm library.
:brain4: Maintain a separate “sort order” string for each name, sort it on strcasecmp()
Replies (1)
-
@knack@aus.social 2026-09-07 22:50
@futzle@old.mermaid.town I discovered collation rules existed when I fielded a bug report of results being returned in a different order on different hosts. Turned out we used both US and AU collations, and they had different opinions about how to sort strings in Thai script, meaning the order of results using that script was inconsistent. That was also the job where I discovered that U+2028 and U+2029 were valid unescaped characters in JSON, but not in javascript object literals, meaning you couldn't use `eval` in the browser to parse JSON (this has since been fixed in the relevant spec).