Understanding key points: a standard abstraction with a concrete implementation, two codes consistent
Coding specification standards such as Unicode, encoding specific implementation: such as UTF8 (remember the key points, easy to understand)
The correct output, the content of the display is encoded in accordance with the actual type of local coding system
The character encoding that is declared within the program file or the IDE is sometimes different from the actual encoding
Python uses MBCS for win local code ( Program Files strongly recommend Unicode implementation)
Local coded character set may not include specific characters
To correctly decode the decode string itself, encode the encoding to be consistent with the actual type of codec specified
Key points of use: three u
Generate Chinese file name in program:u' Chinese file name '
File, IDE encoding is best unified using uTf8
Database Chinese best unicode
eg
>>>print ' Yan '. Decode (' UTF8 '). Encode (' GBK ') strict >>>print u ' Yan '. Encode (' GBK ')
Python Decoding Coding Essentials