Coding problems have always been a headache:
When the string is '\ u4e2d \ u56fd'
>>> S = ['\ u4e2d \ u56fd', '\ u6e05 \ u534e \ u5927 \ u5b66']
>>> STR = s [0]. Decode ('unicode _ escape ') #. encode ("euc_kr ")
>>> Print Str
China
When the string is '& #19996; & #20122; & #23398; & #22242; & #19968; & #20013 ;'
>>> Print unichr (19996)
East
Ord () supports Unicode and can display Unicode numbers of specific characters, such:
>>> Print ord ('A') 65
Unicode strings are generated as long as they are connected to Unicode. For example:
>>> 'Help'> 'Help, '+ u'python' u'help, python'
For ASCII (7-bit)-compatible strings, you can convert Unicode strings into ASCII strings with the built-in STR () function.For example:
>>> STR (u'hello World') 'Hello world'
Understanding of several concepts:
ASCII code: Use data words to correspond to corresponding characters
The Chinese Character corresponds to the location code. For example, the "good" ASCII code is 22909.
Unicode encoding is divided into one field for each country. It has UTF-8, UTF-16, UTF-32 AND OTHER FORMS
The Chinese value range is 4e00-9fbf. GBK, gb2312,
UTF-8 is a Unicode-based international application.
Gb2312 and gb2312 are both early Chinese character codes used for encoding and decoding.