Windows,python2 environment, when GVIM is configured with set Fileencoding=utf-8, the new file is encoded as Utf-8.
0 UTF-8 encoding can be used if the code does not contain Chinese, or if it contains only Chinese comments. Just add #-*-coding:utf-8-*-to the file header. You can use the command in Gvim: set fileencoding to see how the document is encoded, and if it is not utf-8, you can set it using the command: Set Fileencoding=utf-8.
0 if the code body contains Chinese, the Utf-8 encoding is not available because the default Chinese encoding method for Windows is GBK, so if you encode in Utf-8, the execution results are garbled. At this time to use GBK encoding, that is, the file header plus #-*-CODING:GBK-*-, in addition to the file encoding to GBK, the use of commands in Gvim: Set FILEENCODING=GBK can, note, set to save after completion, with the command: set fileencoding view file encoding method can get results for fileencoding=cp936, note that this result is correct, because GBK is an extension of cp936.
Windows, Gvim Edit, Python2 application garbled problem