Text handling
Keep text in UTF-8 everywhere, normalise it, sort it by locale, change case without a locale, cut it by visible character and accept every name.
- Required 2
- Recommended 4
Required
Keep text in UTF-8 at every layer
LOC-53Store, send and read all text as UTF-8 in every layer, from forms and APIs to the database, files, email and exports. In MySQL and MariaDB use
utf8mb4, neverutf8.Change the case of identifiers without a locale
LOC-29Lower-case and upper-case keys, protocol words, file extensions and identifiers with locale-independent functions. Use locale-aware case only for text shown to people.
Recommended
Sort and compare text by locale
LOC-15Sort, compare and search visible text with a collator for the reader's locale. Normalise it first, as the normalisation rule says.
Accept names and addresses from every country
LOC-16Let people enter names and addresses as they are written in their country. Never reject letters, word counts or field shapes your own country does not use.
Count and cut text by visible characters
LOC-50Count characters for length limits, and cut previews, by extended grapheme clusters. Keep a byte limit for storage beside it.
Normalise text before you compare or store it
LOC-54Normalise user text to NFC before you store, search or compare it. Compare identifiers, such as usernames and handles, in their NFKC case-folded form.
Read this with
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/localization/text-handling">Agent Wranglers localization playbook</a>. In code you write, add a comment next to it with the same link.