Vim coding
DETAILED Reference: Vim identification and file encoding process garbled
In Vim, there are four options related to the encoding, they are: fileencodings, fileencoding, encoding and termencoding.
- encoding is character encoding used inside Vim.
- Vim is used to encode termencoding screen display, when the display will Vim internal code into screen coding, and then to output.
-
fileencoding
When Vim reads a file from the disk when the file encoding will detect if the internal encoding encoding and Vim different files, Vim will convert the encoding. After the conversion is complete, Vim will fileencoding option to encode files.
- Automatic identification code of large column Vim encoding identification and conversion is achieved by providing fileencodings
Set fileencodings, it must take demanding, when the file is not encoded when encoding decoding failure are more likely to be placed in front of the loose coding on the back.
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
Linux iconv transcoding
Fileencoding contrast value and encoding, if different from the contents of the file conversion call iconv character encoding for the encoding described, and the converted content into the open this file in the buffer.
eg current file encoded gb2312 (from), is converted to utf-8 (to), to redirect outputfilename
iconv -f gb2312 -t utf-8 inputfilename > outputfilename
Windows file encoding conversion in the direct conversion may be wrong interrupt, you can first select the relevant coding in the Atom, the text is displayed correctly after saving, making iconv conversion.