Character Encoding Reference

A character encoding maps text to bytes. This table covers common encodings like ASCII, UTF-8, GBK, GB2312, Big5, ISO-8859-1 with meaning and typical use, helping with mojibake and encoding choices.

EncodingMeaningTypical Use
ASCII7-bit charset covering English letters, digits and basic symbols (0-127)Oldest base encoding, compatible subset of all modern encodings
UTF-8Variable-length Unicode encoding, 1-4 bytesWeb default; covers every language; Chinese is 3 bytes
UTF-16Unicode 2 or 4 byte encodingCommon in Windows/Java/.NET internals; JS string backing
UTF-32Fixed 4-byte Unicode encodingSimple but bulky; rarely used for transfer
ISO-8859-1Latin-1, single-byte for Western European languagesHTTP default; often confused with Windows-1252
Windows-1252CP1252, superset of Latin-1 with € and more printable charsWindows Western default; browsers often parse 8859-1 as 1252
GBKChinese internal code extension, double-byte for simplified+traditionalOld Chinese Windows default; compatible with GB2312
GB2312Early simplified-Chinese double-byte encodingBasic simplified charset, fully covered by GBK
GB18030Mandatory national standard covering CJK and minority scriptsRequired by Chinese gov/finance; compatible with GBK
Big5Big-5, traditional-Chinese double-byte encodingTraditional Chinese encoding in HK/Taiwan
Shift-JISJapanese encoding, mixed single/double byteJapanese Windows default
EUC-KRKorean double-byte encodingTraditional Korean encoding

Frequently Asked Questions

What is the difference between UTF-8 and GBK?

UTF-8 is a variable-length Unicode encoding covering every language — the de-facto web standard. GBK is a Chinese double-byte encoding covering only Chinese and English; it is smaller but cannot represent other languages. Modern projects should standardize on UTF-8 to avoid mojibake.

Why does mojibake (garbled text) happen?

Mojibake appears when text saved in encoding A is decoded as encoding B. The most common case is Chinese saved as GBK but read as UTF-8 (or vice versa). Keep file, database and HTTP charset (charset=utf-8) consistent to avoid it.

Are ISO-8859-1 and Windows-1252 the same?

No, but they are often confused. 8859-1 has control characters in 0x80-0x9F; 1252 puts printable characters there (e.g. €, smart quotes). Browsers often parse a declared 8859-1 as 1252, so 1252 is the clearer choice.

Which encoding do emoji use?

Emoji are Unicode; under UTF-8 they are usually 4 bytes (more for some new ones), and under UTF-16 a surrogate pair. As long as the system uses UTF-8, emoji store and display correctly.