Under Default Linux,
>>> str1=u ' Chinese '
>>> str2= ' Chinese '
>>> STR1,STR2
(U ' \u4e2d\u6587 ', ' \xe4\xb8\xad\xe6\x96\x87 ')
Under Windows: (U ' \u4e2d\u6587 ', ' \xd6\xd0\xce\xc4 ')
As can be seen from this point, Windows terminal by default is Gb2312,linux terminal default is Utf-8
>>> str1.encode (' Utf-8 ')
' \xe4\xb8\xad\xe6\x96\x87 '
>>> str1.encode (' Utf-8 '). Decode (' Utf-8 ')
U ' \u4e2d\u6587 '
>>> str1.encode (' gb2312 ')
' \xd6\xd0\xce\xc4 '
>>> str1.encode (' gb2312 '). Decode (' gb2312 ')
U ' \u4e2d\u6587 '
>>> str1.encode (' GBK ')
' \xd6\xd0\xce\xc4 '
>>> str1.encode (' GBK '). Decode (' GBK ')
U ' \u4e2d\u6587 '
>>> string1= ' \xe4\xb8\xad\xe6\x96\x87 '
>>> print String1.decode (' Utf-8 ')
Chinese
>>> string2= ' \xd6\xd0\xce\xc4 '
>>> print String2.decode (' gb2312 ')
Chinese
>>> print String2.decode (' GBK ')
Chinese
>>> print ' \xe4\xb8\xad\xe6\x96\x87 '
Chinese
Under Windows terminal,
>>> print ' \xe4\xb8\xad\xe6\x96\x87 '
Juan PO
>>> print String3.decode (' Utf-8 ')
Chinese
Python character encoding displays in Chinese