Unicode

On this page 7

Unicode is the international standard that assigns a unique number, called a code point, to every character used in writing systems, symbols and emoji, so that text keeps its meaning when it moves between programs, devices and operating systems. In software interoperability it is the common vocabulary for text: two applications that agree on Unicode can exchange names, documents and messages in any language without guessing which character set the other side used.

The standard is maintained by the Unicode Consortium and kept synchronized with the international standard ISO/IEC 10646. It defines far more than a list of characters: it also specifies properties, normalization, sorting, line breaking and bidirectional display, which together decide whether text is processed correctly once it arrives.

How Unicode separates characters from bytes

Unicode works by splitting text handling into two distinct layers: an abstract character repertoire and the encoding forms that turn code points into bytes. A code point is written as U+ followed by hexadecimal digits, for example U+0041 for the Latin capital A and U+20AC for the euro sign. The codespace runs from U+0000 to U+10FFFF, which gives room for 1,114,112 code points, of which roughly 150,000 are currently assigned to characters.

The codespace is divided into 17 planes of 65,536 code points each. Plane 0, the Basic Multilingual Plane (BMP), holds most modern scripts, while the supplementary planes hold historic scripts, rare ideographs, mathematical symbols and most emoji. This split matters in practice because older software that assumed every character fits in 16 bits fails precisely on supplementary characters.

The following table shows the main structural units that the standard defines and why each one affects interoperability.

UnitWhat it isWhy it matters
Code pointA number from U+0000 to U+10FFFFIdentifies one abstract character
PlaneA block of 65,536 code pointsSeparates BMP from supplementary characters
Code unitThe 8, 16 or 32-bit storage unit of an encoding formDetermines string length in memory
Grapheme clusterWhat a reader perceives as one characterGoverns cursor movement and truncation
Surrogate pairTwo 16-bit units representing one code pointBreaks naive UTF-16 string handling
Core structural units of the standard

Unicode encoding forms and their trade-offs

Unicode defines three standard encoding forms, UTF-8, UTF-16 and UTF-32, and all of them can represent every code point without loss. They differ in storage size, compatibility with legacy systems and the effort needed to index a string. Choosing between them is an engineering decision, not a question of which characters are supported.

The comparison below summarizes where each form is typically found in software and what developers must watch for.

Encoding formBytes per code pointTypical homeMain caveat
UTF-81 to 4Web, files, network protocols, LinuxVariable length complicates indexing
UTF-162 or 4Windows APIs, Java, JavaScript stringsSurrogate pairs and byte order
UTF-324Internal processing in some librariesLarge memory footprint
Comparison of the three Unicode encoding forms

UTF-8 has become the default interchange encoding because it is backward compatible with ASCII and has no byte-order ambiguity. UTF-16 persists inside platforms whose string types were designed in the early 1990s, so most real systems convert at their boundaries. The neighboring Terms on character encoding and UTF-8 cover the byte-level mechanics in more detail.

Normalization, equivalence and comparison

Unicode normalization is the process that converts equivalent character sequences into one consistent form so that they compare as equal. The letter “é” can be stored as a single precomposed code point U+00E9 or as the letter e followed by a combining acute accent U+0301. Both render identically, yet a byte-by-byte comparison treats them as different strings.

The standard defines four normalization forms, which differ in whether they compose or decompose characters and whether they apply compatibility mappings.

FormOperationTypical use
NFCCanonical decomposition, then compositionDefault for storage and the web
NFDCanonical decomposition onlySome file systems and linguistic processing
NFKCCompatibility decomposition, then compositionIdentifiers, search keys, usernames
NFKDCompatibility decomposition onlyText analysis and indexing
The four normalization forms

Compatibility forms are lossy: they turn the ligature “fi” into “fi” and a superscript two into a plain digit. They are suited to matching and search, but applying them to stored documents silently changes content. A sound rule is to normalize to NFC at system boundaries and use NFKC only for comparison keys.

Character properties and text algorithms

Beyond code points, the Unicode Character Database assigns each character properties such as general category, script, case mappings, numeric value and bidirectional class. Software relies on these properties for case-insensitive matching, word segmentation and validation of input. Hard-coding rules such as “letters are A to Z” breaks as soon as users type in Greek, Arabic or Devanagari.

Several companion specifications, published as Unicode Standard Annexes and Technical Standards, define algorithms that interoperable software is expected to share:

  • Bidirectional algorithm (UAX #9) for mixing right-to-left and left-to-right text
  • Text segmentation (UAX #29) for grapheme, word and sentence boundaries
  • Line breaking (UAX #14) for wrapping text in layouts
  • Collation algorithm (UTS #10) for language-aware sorting
  • Security mechanisms (UTS #39) for detecting confusable characters

Locale data that tailors these algorithms, such as sorting rules for Swedish or date formats for Japanese, comes from the Common Locale Data Repository (CLDR), which the Consortium maintains alongside the standard.

Common Unicode failures in software

Most Unicode problems in software come from mismatched assumptions at boundaries rather than from missing characters. A file written in one encoding and read as another, a database column with a legacy character set or a string function that counts code units instead of characters all produce visible defects.

The table below links typical symptoms to their usual causes and fixes.

SymptomLikely causeFix
Mojibake such as “é” instead of “é”UTF-8 bytes decoded as Windows-1252Declare and verify the encoding at every interface
Replacement character U+FFFDInvalid byte sequences during decodingReject or log invalid input at the source
Emoji split into two boxesTruncation inside a surrogate pairTruncate on grapheme cluster boundaries
Duplicate accounts with identical namesMissing normalization before comparisonNormalize and case-fold usernames
Lookalike domain or usernameHomograph attack with confusable lettersApply confusable detection and script mixing rules
Symptoms, causes and fixes

A frequent misconception is that one code point equals one visible character. Flags, skin-tone emoji and many Indic syllables consist of several code points, so length limits, cursor logic and substring operations should work on grapheme clusters whenever users can see the result.

The short version

Computers store letters as numbers. In the past, different countries and companies used different number tables, so the same number could mean a Czech letter on one computer and a Russian letter on another. Text often turned into nonsense when it traveled between systems.

Unicode is one shared table for the whole world. Every letter, symbol and emoji gets its own permanent number, so any program that follows the standard reads the text exactly as it was written. It works like a universal dictionary that every computer has agreed to use.

Where it makes a difference

A logistics company merges customer records from a German warehouse system, a Polish billing tool and a French web shop. The older systems store names in three different legacy code pages, and the first test import shows thousands of corrupted surnames, with “Müller” appearing as “Müller” and Polish letters replaced by question marks.

The integration team converts every source to UTF-8 at the import stage, normalizes all names to NFC and adds a check that rejects invalid byte sequences instead of silently replacing them. Duplicate detection then compares case-folded, normalized names. After the change, the merged database of about 400,000 customers shows no corrupted names, and roughly 2,300 duplicates that differed only in accent encoding are correctly identified and merged.