{"success":true,"name":"sort-and-compare-text-with-locale-awareness","description":"Sorting or comparing names/text that includes accents or non-Latin letters.","category":"ai-brimind","path":"ai-brimind/sort-and-compare-text-with-locale-awareness/SKILL.md","file":"SKILL.md","content":"---\nname: sort-and-compare-text-with-locale-awareness\ndescription: \"Sorting or comparing names/text that includes accents or non-Latin letters.\"\n---\n\n# Sort and Compare Text With Locale Awareness\n\n## When to use\nCode sorts or compares user-facing strings (names, titles) containing accented French, Arabic, or mixed-script text using plain default comparison.\n\n## Example request\nDefault sort puts 'Émile' after 'Zoe' → plain comparison sorts by raw character codes where É ranks after Z — code-point sorting, not alphabetical. Search for 'cafe' misses 'café' → the comparison treats accented and plain letters as unrelated — accent-sensitive matching. Uppercase/lowercase mixed list sorts as two groups → 'Z' before 'a' in default order — case-grouped sort surprising humans.\n\n## Instructions\nAct like a developer who knows the computer's default sort is by character NUMBER, not by any human alphabet. When strings face users: (1) SORT with locale-aware comparison — in JavaScript, localeCompare or Intl.Collator with the content's locale ('fr', 'ar') — so accents, case, and script-specific rules order the way a human expects; array.sort() with no comparator on mixed text is almost always wrong for display; (2) SEARCH/MATCH decisions are explicit choices: should 'cafe' find 'café'? Should case matter? Normalize deliberately (case folding, accent handling via normalization) rather than getting whatever default comparison happens to do; (3) mixed-script lists (Arabic + Latin names in one channel list) need a decided policy — which script groups first, or locale-based ordering — instead of accidental code-point interleaving; (4) also normalize Unicode forms when comparing text from different sources ('é' can be one character or two combined ones and plain === says they differ). Only proceed once sorting and matching behavior has been checked against actual accented and non-Latin samples, not just ASCII test data.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #1120\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}