GB 18030 explained

GB 18030
Mime:GB18030
Alias:Code page 54936
Standard:GB 18030-2022, GB 18030-2005, GB 18030-2000, GB 18030-2022
Lang:International, but primarily meant for Chinese
Encodes:ISO 10646 (Unicode)
Extends:EUC-CN, GBK
Prev:GBK, GB2312
Classification:Unicode Transformation Format, extended ASCII, variable-width encoding, CJK encoding

GB 18030 is a Chinese government standard, described as Information Technology — Chinese coded character set and defines the required language and character support necessary for software in China. GB18030 is the registered Internet name for the official character set of the People's Republic of China (PRC) superseding GB2312.[1] As a Unicode Transformation Format (i.e. an encoding of all Unicode code points), GB18030 supports both simplified and traditional Chinese characters. It is also compatible with legacy encodings including GB/T 2312, CP936, and GBK 1.0.

The Unicode Consortium has warned implementers that the latest version of this Chinese standard, GB 18030-2022, introduces what they describe as "disruptive changes" from the previous version GB 18030-2005 "involving 33 different characters and 55 code positions".[2] GB 18030-2022 was enforced from 1 August 2023.[3] It has been implemented in ICU 73.2; and in Java 21,[4] and backported to older Java 8, 11, 17 (LTS releases) and 20.0.2.[5]

In addition to the encoding method, this standard contains requirements about which additional scripts and languages should be represented, and to whom this standard is applicable. This standard however does not define the official character forms for the Chinese characters; this is standardised in Table of General Standard Chinese Characters.

History

See also: GB 2312, GBK (character encoding) and Code page 936 (Microsoft Windows). The GB18030 character set is formally called "Chinese National Standard GB 18030-2005: Information Technology—Chinese coded character set". GB abbreviates Guójiā Biāozhǔn (国家标准), which means national standard in Chinese. The standard was published by the China Standard Press, Beijing, 8 November 2005. Only a portion of the standard is mandatory. Since 1 May 2006, support for the mandatory subset is officially required for all software products sold in the PRC.

GB byte
sequence !! colspan=2
Unicode code point
GB 18030-2000GB 18030-2005
A8 BC (ḿ)
81 35 F4 37

An older version of the standard, known as "Chinese National Standard GB 18030-2000: Information Technology—Chinese ideograms coded character set for information interchange—Extension for the basic set", was published on March 17, 2000. The encoding scheme stays the same in the new version, and the only difference in GB-to-Unicode mapping is that GB 18030-2000 mapped the character (ḿ) to a private use code point U+E7C7, and character (without specifying any glyph) to U+1E3F (ḿ), whereas GB 18030-2005 swaps these two mapping assignments.[6] More code points are now associated with characters due to update of Unicode, especially the appearance of CJK Unified Ideographs Extension B. Some characters used by ethnic minorities in China, such as Mongolian characters and Tibetan characters (GB 16959-1997 and GB/T 20542-2006), have been added as well, which accounts for the renaming of the standard.

Compared with its ancestors, GB 18030's mapping to Unicode has been modified for the 81 characters that were provisionally assigned a Unicode Private Use Area code point (U+E000–F8FF) in GBK 1.0 and that have later been encoded in Unicode.[7] This is specified in Appendix E of GB 18030.[6] [8] There are 24 characters in GB 18030-2005 that are still mapped to Unicode PUA.[9]

In the GB 18030-2022 update, the requirements for characters to be mapped to PUA has been lifted completely and all characters should be mapped to their standard Unicode codepoints. Of these, 18 mappings were updated by position-swapping similar to what happened between GBK and GB 18030. The remaining six kept the two-byte PUA mappings, so that a change to the 4-byte sequence is needed to follow the non-PUA preference.[10]

GB byte
sequence !! colspan=4
Unicode code point
GBK 1.0[11] GB 18030-2005Unicode 4.1GB 18030-2022
A6 D9[12] U+E78D
A6 DAU+E78E
A6 DBU+E78F
A6 DCU+E790
A6 DDU+E791
A6 DEU+E792
A6 DFU+E793
A6 ECU+E794
A6 EDU+E795
A6 F3U+E796
A8 BCU+E7C7
A8 BFU+E7C8
A9 89U+E7E7
A9 8AU+E7E8
A9 8BU+E7E9
A9 8CU+E7EA
A9 8DU+E7EB
A9 8EU+E7EC
A9 8FU+E7ED
A9 90U+E7EE
A9 91U+E7EF
A9 92U+E7F0
A9 93U+E7F1
A9 94U+E7F2
A9 95U+E7F3
FE 50U+E815
FE 51U+E816U+E816
FE 52U+E817U+E817
FE 53U+E818U+E818
FE 54U+E819
FE 55U+E81A
FE 56U+E81B
FE 57U+E81C
FE 58U+E81D
FE 59U+E81E
FE 5AU+E81F
FE 5BU+E820
FE 5CU+E821
FE 5DU+E822
FE 5EU+E823
FE 5FU+E824
FE 60U+E825
FE 61U+E826
FE 62U+E827
FE 63U+E828
FE 64U+E829
FE 65U+E82A
FE 66U+E82B
FE 67U+E82C
FE 68U+E82D
FE 69U+E82E
FE 6AU+E82F
FE 6BU+E830
FE 6CU+E831U+E831
FE 6DU+E832
FE 6EU+E833
FE 6FU+E834
FE 70U+E835
FE 71U+E836
FE 72U+E837
FE 73U+E838
FE 74U+E839
FE 75U+E83A
FE 76U+E83BU+E83B
FE 77U+E83C
FE 78U+E83D
FE 79U+E83E
FE 7AU+E83F
FE 7BU+E840
FE 7CU+E841
FE 7DU+E842
FE 7EU+E843
FE 80U+E844
FE 81U+E845
FE 82U+E846
FE 83U+E847
FE 84U+E848
FE 85U+E849
FE 86U+E84A
FE 87U+E84B
FE 88U+E84C
FE 89U+E84D
FE 8AU+E84E
FE 8BU+E84F
FE 8CU+E850
FE 8DU+E851
FE 8EU+E852
FE 8FU+E853
FE 90U+E854
FE 91U+E855U+E855
FE 92U+E856
FE 93U+E857
FE 94U+E858
FE 95U+E859
FE 96U+E85A
FE 97U+E85B
FE 98U+E85C
FE 99U+E85D
FE 9AU+E85E
FE 9BU+E85F
FE 9CU+E860
FE 9DU+E861
FE 9EU+E862
FE 9FU+E863
FE A0U+E864
Notes

a.

Blue indicates private use area

b. mapped to 0x95329031 in GB 18030-2022

c. mapped to 0x95329033 in GB 18030-2022

d. mapped to 0x95329730 in GB 18030-2022

e. mapped to 0x9536B937 in GB 18030-2022

f. mapped to 0x9630BA35 in GB 18030-2022

g. mapped to 0x9635B630 in GB 18030-2022

As a national standard

The first version of GB 18030, designated GB 18030-2000 Information Technology—Chinese coded character set for information interchange — Extension for the basic set, consists of 1-byte and 2-byte encodings, together with 4-byte encoding for CJK Unified Ideographs Extension A matching those in Unicode 3.0. The corresponding Unicode code points of this subset, including provisional private assignments, lie entirely in the BMP. These parts are fully mandatory in GB 18030-2000. Most major computer companies had already standardized on some version of Unicode as the primary format for use in their binary formats and OS calls. However, they mostly had only supported code points in the BMP originally defined in Unicode 1.0, which supported only 65,536 codepoints and was often encoded in 16 bits as UCS-2. This standard is basically an extension based on GBK with additional characters in CJK Unified Ideographs Extension A.

The second version designated GB 18030-2005 Information Technology—Chinese coded character set has the same mandatory subset as GB 18030-2000 of 1-, 2- and 4-byte encodings. This version also includes the full CJK Unified Ideographs Extension B in the 4-byte encoding section which is outside the BMP as a suggestion support requirement.[13] However, as the inclusion of CJK Unified Ideographs Extension B in a 4-byte region is required to be maintained during information processing, software can no longer get away with treating characters as 16-bit fixed width entities (UCS-2). Therefore, they must either process the data as a variable-width format (as with UTF-8 or UTF-16), which is the most common choice, or move to a larger fixed-width format (i.e. UTF-32). Microsoft made the change from UCS-2 to UTF-16 with Windows 2000. This version matches with Unicode 3.1, and also provided support for Hangul (Korean), Mongolian (including Manchu, Clear script, Sibe hergen, Galik), Tai Nuea, Tibetan, Uyghur/Kazakh/Kyrgyz and Yi.

The third and latest version, GB 18030-2022 Information Technology—Chinese coded character set, mandates the suggestion support part of CJK Unified Ideographs Extension B in GB 18030-2005, along with updates up to Unicode 11.0 including Kangxi Radicals and CJK Unified Ideographs Extension C, D, E and F. Additional languages are also recognized by GB 18030-2022 such as part of Arabic, Tai Le, New Tai Lue, Tai Tham, Lisu, and Miao. GB 18030-2022 also introduces three implementation levels, with the requirement of "all products using this standard should implements Implementation Level 1" that includes 66 new BMP characters in the 4-byte encoding region that were added between Unicode 3.1 and Unicode 11.0. Implementation Level 2 requires the support of Table of General Standard Chinese Characters, and Implementation Level 3 requires all other specified regions in the standard.

Mapping

GB 18030 defines a one (ASCII), two (extended GBK), or four-byte (UTF) encoding. The two-byte codes are defined in a lookup table, while the four-byte codes are defined sequentially (hence algorithmically) to fill otherwise unencoded parts in UCS. GB 18030 inherits the bad aspects of GBK, most notably needing special code to safely find ASCII characters in a GB18030 sequence.

GB 18030 encoding[14]
GB 18030code pointsUnicode
byte 1 (MSB) byte 2 byte 3 byte 4
128
invalid
– except – except –
reserved for future character extension
reserved for future ideographic extension
unassigned
{{digit groups|1|0000}}{{digit groups|10|FFFF}}
reserved for future standard extension
user-defined
invalid
Total

The one- and two-byte code points are essentially GBK with the euro sign, PUA mappings for unassigned/user-defined points, and vertical punctuations. The four byte scheme can be thought of as consisting of two units, each of two bytes. Each unit has a similar format to a GBK two byte character but with a range of values for the second byte of 0x30–0x39 (the ASCII codes for decimal digits). The first byte has the range 0x81 to 0xFE, as before. This means that a string-search routine that is safe for GBK should also be reasonably safe for GB18030 (in much the same way that a basic byte-oriented search routine is reasonably safe for EUC).

This gives a total of 1,587,600 (126×10×126×10) possible 4 byte sequences, which is easily sufficient to cover Unicode's 1,112,064 (17×65536 − 2048 surrogates) assigned, reserved, and noncharacter code points.

Unfortunately, to further complicate matters there are no simple rules to translate between a 4 byte sequence and its corresponding code point. Instead, codes are allocated sequentially (with the first byte containing the most significant part and the last the least significant part) only to Unicode code points that are not mapped in any other manner. For example:

U+00DE (Þ) → 81 30 89 37 U+00DF (ß) → 81 30 89 38 U+00E0 (à) → A8 A4 U+00E1 (á) → A8 A2 U+00E2 (â) → 81 30 89 39 U+00E3 (ã) → 81 30 8A 30

An offset table is used in the WHATWG and W3C version of GB 18030 to efficiently translate code points.[15] ICU[14] and glibc use similar range definitions to avoid wasting space on large sequential blocks.

Support

Encoding

GB18030 has been supported on Windows since the release of Windows 95, as code page 54936.[16] Windows 2000 and XP offer a GB18030 Support Package.[17] The open source PostgreSQL database supports GB18030 through its full support for UTF-8, i.e. by converting it to and from UTF-8. Similarly Microsoft SQL Server supports GB18030 by conversion to and from UTF-16.

More specifically, supporting the GB18030 encoding on Windows means that Code Page 54936 is supported by MultiByteToWideChar and WideCharToMultiByte. Due to the backward compatibility of the mapping, many files in GB18030 can be actually opened successfully as the legacy Code Page 936, that is GBK, even if the Code Page 54936 is not supported. However, that is only true if the file in question contains only GBK characters. Loading will fail or cause corrupted result if the file contains characters that do not exist in GBK (see § Technical details for examples).

GNU glibc's gconv, the character codec library used on most Linux distributions, supports GB 18030-2000 since 2.2,[18] and GB 18030-2005 since 2.14;[19] glibc notably includes non-PUA mappings for GB 18030-2005 in order to achieve round-trip conversion.[20] GNU libiconv, an alternative iconv implementation frequently used on non-glibc UNIX-like environments like Cygwin, supports GB 18030 since version 1.4.[21]

As of 2022, "supporting non-Chinese scripts continues to be optional"[22] (presumably for display/font support only; and in China, since the encoding is a full UTF). The standard is known to support English/ASCII and the "following non-Chinese scripts are recognized by GB 18030-2022: Arabic, Tibetan, Mongolian, Tai Le, New Tai Lue, Tai Tham, Yi, Lisu, Hangul (Korean), and Miao."

Fonts

The GB18030 Support Package for Windows contains SimSun18030.ttc, a TrueType font collection file which combines two Chinese fonts, SimSun-18030 and NSimSun-18030. The SimSun 18030 font includes all the characters in Unicode 2.1 plus new characters found in the Unicode CJK Unified Ideographs Extension A block although, despite its name, it does not contain glyphs for all characters encoded by GB 18030, as all (about a million) Unicode code points up to U+10FFFF can be encoded as GB 18030. GB 18030 compliance certification only requires correct handling and recognition of glyphs in the mandatory (two-byte, and CJK Ext. A) Chinese part.[23] Nevertheless, the requirement of PUA characters in the standard have hampered this implementation.[24]

Microsoft YaHei and DengXian provided by Microsoft are updated in 2023 to match GB 18030-2022 implementation level 2, and SimSun is updated to match implementation level 3.[25]

Source Han Sans (and its counterpart Noto Sans CJK) are already compliant with GB 18030-2022 implementation level 2 when the standard update for GB 18030 is announced . Source Han Serif (and its counterpart Noto Serif CJK) however is not compliant at the time, and an update is provided to ensure the font is compliant to implementation level 2. Similarly Microsoft YaHei and PingFang (Apple) require a small number of URO additions that are associated with implementation level 1 in order to become compliant with GB 18030-2022 implementation level 2.

Other CJK font families like HAN NOM[26] and Hanazono Mincho[27] provide wider coverage for Unicode CJK Extension blocks than SimSun-18030 or even SimSun (Founder Extended), but they don't support all code points defined in GB 18030.

See also

External links

Notes and References

  1. Web site: Application of IANA Charset Registration for GB18030 . IANA Character Set Registrations . 2002-03-15 . Anthony Fok . 2016-12-05.
  2. Web site: Disruptive Changes in GB 18030-2022 . 2024-02-12 . www.unicode.org .
  3. Web site: [JDK-8301119] Support for GB18030-2022 - Java Bug System ]. 2023-08-14 . bugs.openjdk.org.
  4. Web site: JDK 21 Release Notes . 2023-08-14 . jdk.java.net.
  5. Web site: [JDK-8307340] Release Note: Support for GB18030-2022 - Java Bug System ]. 2023-08-30 . bugs.openjdk.org.
  6. Book: Standardization Administration of China (SAC). GB 18030-2005: Information Technology—Chinese coded character set. 2005-11-18.
  7. Web site: Unicode FAQ on GB 18030. ICU Project. 10 September 2016.
  8. Book: GB 18030-2000: Information Technology—Chinese ideograms coded character set for information interchange—Extension for the basic set . Standardization Administration of China (SAC) . 2000-03-17.
  9. Web site: Lunde. Ken. L2/06-394 Update on GB 18030:2005. Unicode Technical Committee Document Registry. L2-06-394. 2006. 28 September 2016.
  10. Web site: Lunde . Ken . The GB 18030-2022 Standard . Medium . 7 August 2022 . en . 4 August 2022.
  11. Web site: Group:GBK外字. GlyphWiki. 11 September 2016.
  12. Book: Lunde. Ken. CJKV Information Processing. December 2008. O'Reilly Media, Inc. 978-0-596-51447-1. 11 September 2016.
  13. Web site: CESI . China Electronics Standardization Institute . 2009-07-08 . GB18030 符合性问与答 . GB18030 compliance FAQ . https://web.archive.org/web/20160928145226/http://www.cc.cesi.cn/UpLoadFolder/OtherFile/200907/2009070816133686.doc . 2016-09-28 . 2016-10-12 . CESI Certification Center . Page 4 同时达到以下两个要求的产品,为符合GB 18030-2005强制部分的产品:①产品可以正确输入、输出、处理GB 18030-2005强制部分规定的全部汉字字符;②产品可以正确识别GB 18030-2005强制性部分规定的全部汉字字符对应的编码。 [A product compliant with the mandatory part of GB 18030 must be able to correctly a) input, output and process all Chinese characters defined in the mandatory set; b) recognize encodings for characters in the mandatory set.].
  14. http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml Authoritative mapping table between GB18030-2000 and Unicode
  15. Web site: Encoding Standard # gb18030-index. WHATWG. 2016-09-24.
  16. Web site: Karl . Bridge . MultiByteToWideChar function (stringapiset.h) - Win32 apps . 13 October 2021 . 2022-11-01 . learn.microsoft.com . en-us.
  17. Web site: GB18030 Support Package. Microsoft. Microsoft. https://web.archive.org/web/20120605011449/https://www.microsoft.com/en-us/download/details.aspx?id=5503. 2012-06-05. dead.
  18. Web site: Drepper. Ulrich. GB18030 iconv module for glibc.. glibc git. 29 November 2016.
  19. Web site: Drepper. Ulrich. Update GB18030 to 2005 version. glibc git. 29 November 2016.
  20. Web site: Weimer. Florian. O'Donell. Carlos. Status of GB18030 tables (#19575). Sourceware Bugzilla. 29 November 2016.
  21. Web site: NEWS - libiconv.git - libiconv. git.savannah.gnu.org. 2016-10-13.
  22. Web site: Lunde . Ken . 2022-08-16 . The GB 18030-2022 Standard . 2022-11-01 . Medium . en.
  23. Web site: GB18030 符合性问与答. CESI. China Electronics Standardization Institute. 2009-07-08. CESI Certification Center. GB18030 compliance FAQ. https://web.archive.org/web/20160928145226/http://www.cc.cesi.cn/UpLoadFolder/OtherFile/200907/2009070816133686.doc. 2016-09-28. 2016-10-12. Page 4 同时达到以下两个要求的产品,为符合GB 18030-2005强制部分的产品:①产品可以正确输入、输出、处理GB 18030-2005强制部分规定的全部汉字字符;②产品可以正确识别GB 18030-2005强制性部分规定的全部汉字字符对应的编码。 [A product compliant with the mandatory part of GB 18030 must be able to correctly a) input, output and process all Chinese characters defined in the mandatory set; b) recognize encodings for characters in the mandatory set.]. Alt URL
  24. Web site: Lunde . Ken . If gb18030 is revised, consider aligning the Encoding Standard · Issue #27 · whatwg/encoding . GitHub . en . Besides, supporting PUA code points in the context of the Noto CJK and Source Han fonts is a total non-starter, mainly because they are Pan-CJK typefaces, and PUA usage is extremely dangerous in such contexts.[...] One of my friends at CESI shared with me the text from the final draft a few days ago. This confirmed that the PUA requirement for the 24 characters is being lifted..
  25. Web site: July 11, 2023—KB5028171 (OS Build 20348.1850) - Microsoft Support . support.microsoft.com . Microsoft . 25 March 2024.
  26. Web site: /hannom. VietUnicode. sourceforge.net. 2016-10-13.
  27. Web site: Hanazono fonts. fonts.jp. 2016-10-13. 2010-04-12. https://web.archive.org/web/20100412205922/http://fonts.jp/hanazono/. dead.