Keeping Exact and Normalized Field Spellings
The same application can preserve a source field for display and derive a normalized key for comparison.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace two spellings
A city field may preserve original accents and capitalization while a search field uses normalization and case folding. Both records can still distinguish an exact spelling when needed. Unicode normalization establishes canonical equivalence, while search policy controls further transformations.
Test key collisions
Two visible labels can normalize to the same key. Check whether inserting the second label should merge, reject, or store another candidate. Canonical label rules make the promised lookup behavior visible.[1]
Detect multiple original names that map to one key
If a schema normalizes field names with case folding, UserID and userid can denote the same normalized name. A single record containing both with different values should follow a collision rule instead of silently choosing whichever member was last. See collection keys and case folding.
Raw members: UserID=4, userid=8
Normalized keys: userid, userid
Under a unique-field contract, reject the collision
Preserve the spelling used in a diagnostic
A parser can normalize for comparison and retain raw spelling for error messages. For a strict exchange format, exact key matching may be the contract. Test changed case, an exact repeat and two distinct values for a normalized key.