From GB2312, GBK to GB18030, these coding methods are backwards compatible, meaning that the same character always has the same encoding in these scenarios, and the latter standard supports more characters. In these codes, English and Chinese can be handled in a unified manner. The method of distinguishing Chinese encoding is that the highest bit of high byte is not 0. According to the programmer, GB2312, GBK, and GB18030 belong to the double-byte character set (DBCS).
Here are the inclusion relationships for these four character sets: GB2312 < GBK < GB18030 < UTF8
-------------------------------------------------------------------------------------------
You can refer to this link http://www.fmddlmyy.cn/text24.html
-------------------------------------------------------------------------------------------
The GB2312 in 1980 included 7,445 characters, including 6,763 Chinese characters and 682 other symbols.
The 1995 Chinese character extension specification GBK1.0 contains 21,886 symbols, including 21,003 Chinese characters and 883 other symbols.
There are two versions of GB18030: gb18030-2000 and gb18030-2005. GB18030-2000 is a replacement version of GBK, and its main feature is the addition of CJK Unified Chinese characters in the GBK basis. The main feature of gb18030-2005 is the addition of CJK Unified Chinese characters to expand B in gb18030-2000 basis.
Otherwise in the processing part of the file, the conversion encoding conversion, there will be a situation that can not be turned, will be error.
In Python, for example,
For-L in open (' Abc_gb18030.txt '): ls = l.rstrip (' \ n '). Decode (' GBK '). "Encode (' the UTF8 '). Split (' \ t ') print ls
Abc_gb18030.txt is GB18030 coding, in the code, first turned to GBK, and then turned into a UTF8, because in the transition to GBK, is another large character set to the small character set, so it will error.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Gb2312,gbk,gb18030,utf8 four kinds of Chinese character coding standards What is the difference and contact