GB 2312

ISO/IEC 2022 UTF-8 GBK (character encoding)
GB 2312
MIME / IANAGB_2312-80 (GB2312 for usual EUC form)
Alias(es)iso-ir-58, chinese, csISO58GB231280
Language(s)Simplified Chinese, English, Russian
Partial support:
Greek, Japanese
StandardGB/T 2312-1980
ClassificationISO-2022-compatible DBCS, CJK encoding
Encoding formatsEUC-CN (GB2312),
Preceded byChinese telegraph code
Succeeded byGBK, GB 18030
Other related encoding(s)JIS X 0208, KS X 1001

GB/T 2312-1980 is a key official character set of the People's Republic of China, used for Simplified Chinese characters. GB2312 is the registered internet name for EUC-CN, which is its usual encoded form. GB refers to the Guobiao standards (国家标准), whereas the T suffix (推荐; tuījiàn; 'recommendation') denotes a non-mandatory standard.[1]

GB/T 2312-1980 was originally a mandatory national standard designated GB 2312-1980. However, following a National Standard Bulletin of the People's Republic of China in 2017, GB 2312 is no longer mandatory, and its standard code is modified to GB/T 2312-1980.[2] GB/T 2312-1980 has been superseded by GBK and GB18030, which include additional characters, but GB/T 2312 remains in widespread use as a subset of those encodings.

While GB/T 2312 covers over 99.99% contemporary Chinese text usage,[3] historical texts and many names remain out of scope. Old GB 2312 standard includes 6,763 Chinese characters (on two levels: the first is arranged by reading, the second by radical then number of strokes), along with symbols and punctuation, Japanese kana, the Greek and Cyrillic alphabets, Zhuyin, and a double-byte set of Pinyin letters with tone marks. In later version GB/T 2312-1980, there are 7,445 letters.

As of June 2020, GB2312 is the most popular Chinese encoding, with 13.6% of web pages served from China and territories declaring it,[4] or 0.4% of all web pages globally, a drop from 3.5% in January 2010.[5] However, note that all major web browsers decode documents marked as e.g. "GB2312" or "GB 2312" (while not all for "GB_2312") as if it were marked "gbk",[6] which is a superset encoding and GB 2312 and GBK have a combined 16.7% share (or 0.6% globally).

There is an analogous character set known as GB/T 12345, closely related to GB/T 2312, but with traditional character forms replacing simplified forms, and some extra 62 supplemental characters.[7][8] GB-encoded fonts often come in pairs, one with the GB/T 2312 (simplified) character set and the other with the GB/T 12345 (traditional) character set.


Characters in GB/T 2312 are arranged in a 94x94 grid (as in ISO 2022), and the two-byte code point of each character is expressed in the kuten (or quwei) form, which specifies a row (ku or qu) and the position of the character within the row (cell, ten or wei).

The rows (numbered from 1 to 94) contain characters as follows:

The rows 10–15 and 90–94 are unassigned.

For GB/T 2312-1980, it contains 682 signs and 6763 Chinese Characters.

Encodings of GB/T 2312


EUC-CN is often used as the character encoding (i.e. for external storage) in programs that deal with GB/T 2312, thus maintaining compatibility with ASCII. Two bytes are used to represent every character not found in ASCII. The value of the first byte is from 0xA1–0xF7 (161–247), while the value of the second byte is from 0xA1–0xFE (161–254). Since all of these ranges are beyond ASCII, like UTF-8, it is possible to check if a byte is part of a multi-byte construct when using EUC-CN, but not if a byte is first or last.

Compared to UTF-8, GB2312 (whether native or encoded in EUC-CN) is more storage efficient: while UTF-8 uses three bytes[a] per CJK ideograph, GB2312 only uses two. However, GB2312 does not cover as many ideographs as Unicode does.

To map the kuten code points to bytes, add 160 (0xA0) to the row number (ku, the 1000s and 100s place) of the code point to form the high byte, and add 160 to the column number (ten, the 10s and 1s place) of the code point to form the low byte.

For example, if you have the GB/T 2312 code point 4566 ("外",[9] which means foreign), the high byte will use the row number 45: 45+160=205=0xCD, and the low byte will come from the column, 66: 66+160=212=0xE2. So, the full encoding is 0xCDE2.[10]


HZ is another encoding of GB 2312 that is used mostly for Usenet postings.

Two implementations of GB/T 2312

There are two implementations of GB/T 2312 which differ in few code points.

EUC-CN GBK/GB18030 subset GB2312.TXT Character name[11]:3
A1A4 U+00B7 · MIDDLE DOT U+30FB KATAKANA MIDDLE DOT 间隔点; 'separator dot'
A1AA U+2014 EM DASH U+2015 HORIZONTAL BAR 破折号; 'em dash'

The GBK/GB18030 subset is compatible with both GBK and GB18030; GB2312.TXT is the then-official implementation from ftp.unicode.org,[12] which has been obsolete since August 2011[13] and missing as of September 2016. Even more vendor mappings existed.[12]

As of 2015, Microsoft .Net Framework is using the subset. ICU,[14] iconv-1.14,[15] php-5.6, ActivePerl-5.20, Java 1.7 and Python 3.4[16] are using GB2312.TXT. Ruby 2.2 is compatible with both implementations; it internally converts the conflictive characters to the subset. W3C's technical recommendation specifies a GBK encoding to be inferred for streams labelled gb2312, which in turn uses a GB18030 decoder.[17]

See also


  1. ^ Lunde, Ken (2009). CJKV Information Processing: Chinese, Japanese, Korean & Vietnamese Computing (2nd ed.). Sebastopol, CA: O'Reilly. pp. 94–111. ISBN 978-0-596-51447-1.
  2. ^ "2017年第7号中国国家标准公告 (China National Standard Bulletin 2017 No.7)". Standardization Administration of the People's Republic of China. Retrieved 3 July 2018.
  3. ^ Hannas, William C. (1997). Asia's Orthographic Dilemma. University of Hawai‘i Press. p. 264. the set provides for better than 99.99 percent of all usage. Nevertheless, the designers found it necessary to add 14,276 "special usage" characters to cover contingencies!
  4. ^ "Distribution of Character Encodings among websites that use China and territories". w3techs.com. Retrieved 2020-06-01.
  5. ^ "Historical trends in the usage of character encodings, June 2020". w3techs.com. Retrieved 2020-06-01.
  6. ^ "Encoding: Summarized test results". www.w3.org. Retrieved 2019-11-15.
  7. ^ "GB/T 12345" (PDF).
  8. ^ GB12345-80 to Unicode table. Unicode Consortium. 1993-12-06. Archived from the original on 2004-06-17.
  9. ^ https://archive.org/details/GB2312-1980/page/n17
  10. ^ https://web.archive.org/web/20160303230643/http://cs.nyu.edu/~yusuke/tools/unicode_to_gb2312_or_gbk_table.html
  11. ^ "GB 2312-1980: Information technology—Chinese ideogram coded character set for information interchange (basic set)". Retrieved 2 October 2016.
  12. ^ a b Haible, Bruno. "GB2312 (Conversion Tables)". Retrieved 29 September 2016.
  13. ^ "Readme – MAPPINGS/OBSOLETE/EASTASIA". 9 August 2001. Retrieved 29 September 2016.
  14. ^ "java-EUC_CN-1.3_P.ucm". Retrieved 29 September 2016.[permanent dead link]
  15. ^ "libiconv:lib/gb2312.h". GNU Savannah. Retrieved 29 September 2016.
  16. ^ "Issue 24036". Python Bug Tracker.
  17. ^ "Encoding § Names and labels". W3C. Retrieved 29 September 2016.


  1. ^ Only for ideographs covered by GB/T 2312, all of which fall into Unicode BMP