: Set fileencoding
You can display the file encoding format. If you just want to see other encoded files or if you want to solve the problem of viewing files garbled with Vim, add the following to the ~/.VIMRC file:
Set Encoding=utf-8 Fileencodings=utf-8
This allows vim to automatically identify the file encoding (which automatically identifies the UTF-8 or GBK encoded file), in fact, in accordance with the fileencodings provided by the encoding list to try, if not found the appropriate encoding, the latin-1 (ASCII) encoding opened.
Opens a file with the specified encoding
such as opening files in Windows that are saved in ANSI
Vim file.txt-c "E ++enc=gb18030"
File Encoding Conversion
Convert file encoding directly into Vim, such as converting a file to Utf-8 format
: Set Fileencoding=utf-8
View file formats
: Set FileFormat?
Set file format to Unix
: Set Fileformat=unix
Reprinted from: http://www.cnblogs.com/sparkbj/p/6212427.html
View file encodings in vim