Canonical equivalence 2026-11-05
Canonical equivalence relates Unicode sequences that represent the same abstract text through canonically interchangeable representations. A precomposed character and its canonical decomposition are an important example. Unicode normalization makes canonically equivalent sequences share a specified normal form.[ref]
Unicode Normalization Forms by the Unicode Consortium. §1.1, Canonical Equivalence; §1.2, NFC and NFD
The single code point
U+00E9 and the pair U+0065 U+0301 differ in length and stored code units, but represent canonically equivalent accented text. NFD maps both to the decomposed pair, while NFC maps both to the composed character. Comparing raw bytes would miss that relationship if the representations differ. In contrast, the circled digit U+2460 and ordinary 1 have compatibility equivalence without canonical equivalence. Canonical normalization thus preserves more distinctions than the compatibility forms. Compatibility equivalence 2026-11-05
Compatibility equivalence relates Unicode sequences whose compatibility decompositions agree, including distinctions that may matter in some contexts. It includes canonical matches but can additionally identify characters differing in formatting or conventional presentation. Unicode normalization forms NFKD and NFKC use these broader decompositions.[ref]
Unicode Normalization Forms by the Unicode Consortium. §1.1, Compatibility Equivalence; §1.2, compatibility normalization forms
For example, the circled digit
U+2460 and ordinary digit U+0031 both normalize to 1 under NFKC. NFC retains their distinction. A circled list marker and an ordinary numeral can therefore become indistinguishable under compatibility normalization, even when an application wanted to preserve the original notation. The choice is a representation policy, not a test of visual similarity: applying compatibility normalization requires deciding which distinctions the task may safely discard. Grapheme cluster 2026-11-05
A grapheme cluster is a sequence of Unicode code points treated as a unit by a text-segmentation rule. Default extended grapheme clusters approximate user-perceived characters, supporting operations such as moving a text cursor or deleting a visible unit. They are not a universal linguistic definition of a text character; boundaries can require language-specific tailoring.[ref]
Unicode Text Segmentation by the Unicode Consortium. Sections1,3 and3.1.1: purpose, extended clusters and default boundary rules
For example,
e followed by the combining character U+0301 COMBINING ACUTE ACCENT contains two code points, but forms one default extended grapheme cluster. Its UTF-8 representation has three bytes: 65 CC 81 in hexadecimal notation. The precomposed U+00E9 also forms one grapheme cluster, with two UTF-8 bytes, C3 A9. The two representations correspond under the canonical rules of Unicode normalization.[ref]Unicode Normalization Forms by the Unicode Consortium. Sections1.1–1.3: canonical equivalence, decomposition and composition
A glyph count answers another question: text shaping can represent the two text characters
f and i by one typographic ligature even though their default grapheme cluster boundary remains. Byte offsets, code point offsets, grapheme cluster boundaries and glyph indices therefore serve different purposes. International Components for Unicode 2026-11-05
International Components for Unicode, commonly abbreviated ICU, is a set of libraries providing Unicode text processing and software internationalization services. Its C/C++ and Java implementations support tasks such as character encoding conversion, Unicode normalization, text-boundary analysis, language-sensitive sorting and formatting. A software locale selects conventions for a language or region; it does not change the abstract numerical value being formatted.[ref]
ICU User Guide by the Unicode Consortium. Introduction to ICU; ICU Services
For a text example, a visually accented letter can be represented by the single code point
U+00E9 or by U+0065 U+0301, a base letter followed by a combining accent. Those sequences differ as raw code-point arrays. A Unicode normalization service can bring these canonically equivalent sequences into the same normalization form before a comparison. This is distinct from translating a word or deciding a language-specific sort order.[ref]Unicode Normalization Forms by the Unicode Consortium. §§1.1–1.3: canonical equivalence and normalization
Such services make a useful division of labor: the application supplies meaning and policy, while a library implements detailed text and formatting rules. Storing text as UTF-8 alone does not implement software internationalization; the program must still handle boundaries, comparisons, numbers, dates and displayed messages appropriately.[ref]
ICU User Guide by the Unicode Consortium. ICU Services; Locales and Resources; Formatting
Unicode normalization 2026-11-05
Unicode normalization maps text to a specified standard representation while respecting a chosen equivalence relation between Unicode sequences. Canonical normalization uses canonical equivalence; compatibility normalization additionally uses compatibility equivalence. NFD decomposes canonical combinations, NFC then composes where permitted, and NFKD/NFKC additionally apply compatibility decompositions.[ref]
Unicode Normalization Forms by the Unicode Consortium. §1.1, canonical and compatibility equivalence; §1.2, normalization forms
For example,
U+00E9 and U+0065 U+0301 represent canonically equivalent accented text. NFD produces the second sequence from either input, while NFC produces the first. NFKC also changes the circled digit U+2460 to the ordinary digit U+0031; NFC preserves that compatibility distinction. The choice consequently depends on which distinctions an application intends to retain. Unicode normalization is different from choosing a character encoding or a font, and it does not make every visually similar pair of strings equal.