|Alias(es)||Code page 54936|
|Standard||GB 18030-2005, GB 18030-2000|
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. As a Unicode Transformation Format (i.e. an encoding of all Unicode code points) compatible with legacy encodings including GB2312, CP936, and GBK 1.0, GB18030 supports both simplified and traditional Chinese characters.
In addition to the "GB18030 character encoding", this standard contains requirements about which scripts must be supported, font support, etc.
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, November 8, 2005. Only a portion of the standard is mandatory. Since May 1, 2006, support for the mandatory subset is officially required for all software products sold in the PRC.
| GB byte|
|Unicode code point|
|GB 18030-2000||GB 18030-2005|
|A8 BC (ḿ)||U+1E3F ḿ|
|81 35 F4 37||U+1E3F ḿ|
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
A8 BC (ḿ) to a private use code point U+E7C7, and character
81 35 F4 37 (without specifying any glyph) to U+1E3F (ḿ), whereas GB 18030-2005 swaps these two mapping assignments.:534 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. This is specified in Appendix E of GB 18030.:534:499 There are 24 characters in GB 18030-2005 that are still mapped to Unicode PUA.
As a national standard
The mandatory part of GB 18030-2005 consists of 1 byte and 2 byte encoding, together with 4 byte encoding for CJK Unified Ideographs Extension A. The corresponding Unicode code points of this subset lie entirely in the BMP.
Most major computer companies had already standardised 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.
In a move of historic significance for software supporting Unicode, the PRC decided to mandate support of certain code points outside the BMP. This means that software can no longer get away with treating characters as 16 bit fixed width entities (UCS-2). Therefore, they must either process the data in a variable width format (such as UTF-8 or UTF-16), which are the most common choices, or move to a larger fixed width format (such as UCS-4 or UTF-32). Microsoft made the change from UCS-2 to UTF-16 with Windows 2000.
Part of the mapping data is from a lookup table (similarly to GBK). The rest is calculated algorithmically. Unfortunately it also inherits the bad aspects of the legacy standards on which it is based (most notably needing special code to safely find ASCII characters in a GB18030 sequence).
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
Windows 2000 can support the GB18030 encoding if GB18030 Support Package is installed. Windows XP can support it natively. 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, and GB 18030-2005 since 2.14; glibc notably includes non-PUA mappings for GB 18030-2005 in order to achieve round-trip conversion. GNU libiconv, an alternative iconv implementation frequently used on non-glibc UNIX-like environments like Cygwin, supports GB 18030 since version 1.4.
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, but despite its name, it does not contain glyphs for all GB 18030 characters, 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) Chinese part.
Other CJK font families like HAN NOM and Hanazono Mincho 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 Unicode 5.0.0 either.
- Note that GB18030 omits surrogates; see #Mapping.
- with the exception of the euro sign which is given a single byte code of 0x80 in Microsoft's later versions of CP936/GBK and a two byte code of A2 E3 in GB18030
- Including the 66 Unicode noncharacters
- ICU seems to erroneously consider this code point valid, which is in neither versions of the published standards. WHATWG assigns this byte to U+20AC (GBK Euro Sign) in its general-use gbk/gb18030 decoder.
- For a finer division of this range see GBK#Encoding.
- Some code points are encoded with two bytes (upper row), the others with four bytes (lower row). U+FFFF is encoded as
84 31 A4 39on page 239 of the 2005 standard, although the standard gives as far as
84 39 FE 39for BMP mapping.
- These are surrogate code points; they have no meaning outside of UTF-16 encoding.
- Standardization Administration of China (SAC) (2005-11-18). GB 18030-2005: Information Technology—Chinese coded character set.
- "Unicode FAQ on GB 18030". ICU Project. Retrieved 10 September 2016.
- Standardization Administration of China (SAC) (2000-03-17). GB 18030-2000: Information Technology—Chinese coded character set for information interchange — Extension for the basic set.
- Lunde, Ken (2006). "L2/06-394 Update on GB 18030:2005". Unicode Technical Committee Document Registry. Retrieved 28 September 2016.
- "Group:GBK外字". GlyphWiki. Retrieved 11 September 2016.
- Lunde, Ken (December 2008). CJKV Information Processing. O'Reilly Media, Inc. ISBN 978-0-596-51447-1. Retrieved 11 September 2016.
- Authoritative mapping table between GB18030-2000 and Unicode. ICU – International Components for Unicode. 2001-02-21. Accessed 2016-09-04.
- "Encoding Standard # gb18030-index". WHATWG. Retrieved 2016-09-24.
- Microsoft. "GB18030 Support Package". Archived from the original on 2012-06-05.
- Drepper, Ulrich. "GB18030 iconv module for glibc.". glibc git. Retrieved 29 November 2016.
- Drepper, Ulrich. "Update GB18030 to 2005 version". glibc git. Retrieved 29 November 2016.
- Weimer, Florian; O'Donell, Carlos. "Status of GB18030 tables (#19575)". Sourceware Bugzilla. Retrieved 29 November 2016.
- "NEWS - libiconv.git - libiconv". git.savannah.gnu.org. Retrieved 2016-10-13.
- CESI (2009-07-08). "GB18030 符合性问与答" [GB18030 compliance FAQ]. CESI Certification Center. Archived from the original on 2016-09-28. Retrieved 2016-10-12.
- VietUnicode. "/hannom". sourceforge.net. Retrieved 2016-10-13.
- "Hanazono fonts". fonts.jp. Retrieved 2016-10-13.
- IANA Charset Registration for GB18030
- English language summary of GB 18030-2000
- Introduction to GB18030 including evolution from GB2312 and GBK (Sun/Internet Archive)
- GB18030: A mega-codepage (IBM DeveloperWorks)
- Authoritative mapping table between GB18030-2000 and Unicode
- ICU Converter Explorer: GB18030
- Unicode CJK Unified Ideographs Extension A (PDF, 1.5MB)
- Unicode CJK Unified Ideographs Extension B (PDF, 13 MB)
- GB18030 Support Package for Windows 2000/XP, including Chinese, Tibetan, Yi, Mongolian and Thai font by Microsoft (Internet Archive)
- SIL's freeware fonts, editors and documentation