24.9 · Unicode equivalence, word boundaries and regional defaults
Text is not a sequence of characters you can slice and compare byte by byte, and regions differ in far more than strings. These checks show what Swift and Foundation do for you.
Mental model. Compare with canonical equivalence, split with a language-aware tokenizer, and read regional defaults from the Locale.
Text
Unicode, tokenizing, regional defaults.
- Why can two visually identical strings differ in bytes, and how do equality, normalisation and case conversion behave for international text?
Unicode lets the same text be written in different ways. “é” can be one scalar (U+00E9) or an “e” followed by a combining accent (U+0065 U+0301). The check… - How do you split text into words, count words or search in languages that do not use spaces?
Splitting on spaces works for English and fails for Chinese, Japanese and Thai, which write words without spaces between them. Use the NaturalLanguage… - What regional defaults should you read from the Locale instead of assuming: units, 12 or 24 hours, ordinals and date order?
The Locale carries decisions you would otherwise guess wrong. The check lists them for six locales: the measurement system (United States uses its own system…
More in Accessibility & localization
- 24.1 · VoiceOver, accessibility elements and the other ways people use an app
- 24.2 · Dynamic Type, display settings, contrast and touch targets
- 24.3 · Right-to-left layout, bidirectional text and number systems
- 24.4 · Testing localisation, and sorting, calendars and names by locale
- 24.5 · Auditing and testing accessibility, and making it a bar, not a backlog
- 24.6 · Building and testing accessible components
- 24.7 · Adaptive colour, font fallback and mirrored drawing
- 24.8 · Language matching, plural rules, string catalogs and Info.plist strings