Skip to content
uencoder

Charset

A character set (charset) is the mapping table from characters to code points; together with an encoding form (such as UTF-8) it determines how text becomes a byte stream.

Purpose

It establishes the correspondence between characters and numbers so that computers can store, transmit, and render text.

Mechanism

The character set defines the mapping from characters to code points (e.g., U+4E2D is the code point of a common Han ideograph); the encoding form defines how code points become bytes (e.g., UTF-8 uses 3 bytes). The HTTP Content-Type charset parameter declares the encoding form.

Use cases

  • Character encoding declaration for web pages
  • Charset settings for database columns
  • File encoding detection and conversion
  • Encoding of protocol text fields

Examples

  • Input
    Content-Type: text/html; charset=utf-8
    Output
    The browser decodes the page as UTF-8

    Declaring the encoding form

Common errors

Confusing a character set (e.g., Unicode) with an encoding form (e.g., UTF-8)
Keep them distinct: the character set defines code points, the encoding form defines bytes

Related terms

Related tools

References