GB 18030, national standard GB 18030-2005, is the latest Chinese internal code set. It was published in March 2000, is compatible with GB 2312-1980 and GBK, and includes 70,244 Chinese characters:
  • Like UTF-8, it uses a multi-byte encoding. A character can take 1, 2, or 4 bytes.
  • The code space is large enough to define up to 1.61 million characters.
  • It supports the scripts of ethnic minorities in China without using a private-use area.
  • The Chinese characters include traditional characters and CJK characters used in Japanese and Korean.
GB 18030 is a variable-length encoding of 1, 2, or 4 bytes:
  • One byte, with values from 0 to 0x7F, compatible with ASCII.
  • Two bytes. The first byte is from 0x81 to 0xFE, and the second byte is from 0x40 to 0xFE (excluding 0x7F), compatible with GBK.
  • Four bytes. The first byte is from 0x81 to 0xFE, the second from 0x30 to 0x39, the third from 0x81 to 0xFE, and the fourth from 0x30 to 0x39.
When processing text, software scans each byte from left to right:
  • If the high bit of the byte is 0, the character uses one byte.
  • If the high bit of the byte is 1, the character may use two bytes or four bytes, so scanning continues:
    • If the high bits of the second byte contain two consecutive 0s, the character uses four bytes.
    • If the high bits of the second byte do not contain consecutive 0s, the character uses two bytes.
A two-byte or four-byte character is checked twice, so GB18030 is slower to process than GB2312 and GBK.