Currently, we are mainly engaged in Chinese character encoding including GBK and GB2312. GB2312, also known as the country code, is a simplified character encoding specification. It also contains other symbols, letters, and Japanese Kana. It contains a total of 7445 graphic characters, of which 6763 are Chinese characters. We usually say 6768 Chinese characters. In fact, there are 5 blank codes, so there are a total of 6763 Chinese characters. GB2312 stipulates that "two bytes are used for any graphic character, and each byte is represented by a seven-bit encoding". The first byte is typically referred to as a "high byte ", the second byte is "low Byte ". The encoding range of Chinese Characters in GB2312 is: the first byte 0xB0-0xF7 (corresponding to decimal: 176-247), and the second byte 0xA0-0xFE (corresponding to decimal: 160-254 ). GBK is an extension of GB2312 and is compatible with the above. The Chinese character encoding in GB2312 is the same as that in GBK, but GBK also contains the traditional Chinese character encoding. Each Chinese Character in GBK still occupies two bytes. The first byte range is 0x81-0xFE (that is, 129-254), and the second byte range is 0x40-0xFE (that is, 64-254 ). GBK contains 23940 bitwise characters and 21003 Chinese characters. Therefore, the following code is also passed in the GB2312 or GBK encoding environment.
sbc_to_dbc( *sbc, * (; *sbc; ++ ((*sbc & ) == && (*(sbc + ) & ) == ) *dbc++ = ++ ((*sbc & ) == && (*(sbc + ) & ) >= && (*(sbc + ) & ) <= ) *dbc++ = *++sbc - (*sbc < ) *dbc++ = *sbc++ *dbc++ = * *dbc = dbc_to_sbc( *dbc, * (; *dbc; ++ ((*dbc & ) == ) *sbc++ = *sbc++ = ((*dbc & ) >= && (*dbc & ) <= *sbc++ = *sbc++ = *dbc + (*dbc < ) *sbc++ = *dbc++ *sbc++ = * *sbc = }