GB 2312

GB 2312
MIME / IANA GB_2312-80 (GB2312 for usual EUC form)
Alias(es) iso-ir-58, chinese, csISO58GB231280
Language(s) Simplified Chinese, English, Russian
Partial support:
Greek, Japanese
Standard GB/T 2312-1980, RFC 1345
Classification ISO-2022-compatible DBCS, CJK encoding
Encoding formats EUC-CN (GB2312),
HZ-GB-2312
Succeeded by GBK, GB 18030
Other related encoding(s) JIS X 0208, KS X 1001

GB2312 is the registered internet name for a key official character set of the People's Republic of China, used for simplified Chinese characters. GB abbreviates Guojia Biaozhun (国家标准), which means national standard in Chinese. GB2312 (1980) has been superseded by GBK and GB18030, which include additional characters, but GB2312 is nonetheless still in widespread use.

According to a National Standard Bulletin of the People's Republic of China, the National Standard GB 2312-1980 is no longer mandatory, and its standard code is modified to GB/T 2312-1980.[1]

While GB2312 covers over 99% of the characters of contemporary usage,[2] historical texts and many names remain out of scope. GB2312 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. 0.4% of all web pages use GB2312 since August 2018, a drop from 3.5% in January 2010.[3]

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

Characters

Characters in GB2312 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:

  • 01-09, comprising punctuation and other special characters; also Hiragana, Katakana, Greek, Cyrillic, Pinyin, Bopomofo
  • 16-55, the first plane for Chinese characters, arranged according to Pinyin. (3755 characters).
  • 56-87, the second plane for Chinese characters, arranged according to radical and strokes. (3008 characters).
  • 88-89, further Chinese characters. (103 characters). Defined only for GB/T 12345, not GB 2312.

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

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

Encodings of GB2312

EUC-CN

EUC-CN is often used as the character encoding (i.e. for external storage) in programs that deal with GB2312, 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[lower-alpha 1] per CJK ideograph, GB2312 only uses two. However, GB2312 does not cover as many ideographs as Unicode does. And GB2312 is less energy efficient, it requires division by 94 which is comparatively expensive, while UTF-8 uses a cheap shift operation.

To map the code points to bytes, add 158 (0x98) to the row number of the code point to form the high byte, and add 158 column number of the code point to form the low byte. The row number is the code point integer divided by 94, and the column the code point modulo 94.

For example, if you have the GB2312 code point 4566 ("外", which means foreign), the high byte will be 4566/94+158=206=0xCE, and the low byte will come from 4566%94+158=212=0xD4. So, the full encoding is 0xCED4=52948.

HZ

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

Two implementations of GB2312

There are two implementations of GB2312 which differ in few code points.

EUC-CNGBK/GB18030 subsetGB2312.TXTCharacter name[5]: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,[6] which has been obsolete since August 2011[7] and missing as of September 2016. Even more vendor mappings existed.[6]

As of 2015, Microsoft .Net Framework is using the subset. ICU,[8] iconv-1.14,[9] php-5.6, ActivePerl-5.20, Java 1.7 and Python 3.4[10] 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.[11]

See also

References

  1. "2017年第7号中国国家标准公告 (China National Standard Bulletin 2017 No.7)". Standardization Administration of the People's Republic of China. Retrieved 3 July 2018.
  2. Hannas, William C. (1997). Asia's Orthographic Dilemma. University of Hawai‘i Press. p. 264.
  3. "Historical trends in the usage of character encodings for websites". W3Techs.
  4. "GB/T 12345" (PDF).
  5. "GB 2312-1980: Information technology—Chinese ideogram coded character set for information interchange (basic set)". Retrieved 2 October 2016.
  6. 1 2 Haible, Bruno. "GB2312 (Conversion Tables)". Retrieved 29 September 2016.
  7. "Readme – MAPPINGS/OBSOLETE/EASTASIA". 9 August 2001. Retrieved 29 September 2016.
  8. "java-EUC_CN-1.3_P.ucm". Retrieved 29 September 2016.
  9. "libiconv:lib/gb2312.h". GNU Savannah. Retrieved 29 September 2016.
  10. "Issue 24036". Python Bug Tracker.
  11. "Encoding § Names and labels". W3C. Retrieved 29 September 2016.

Notes

  1. Only for ideographs covered by GB2312, all of which falls into Unicode BMP.

Further reading

  • Lunde, Ken (2009). "Chinese Character Set Standards—China". CJKV Information Processing (2nd ed.). O'Reilly. ISBN 978-0-596-51447-1.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.