In Linux, you can view the file encoding and modify the encoding. in Linux, you can view the file encoding in the following ways: 1. in Vim, you can directly view the file encoding: set fileencoding to display the file encoding format. If you only want to view files in other encoding formats or want to solve the problem of using Vim to View File garbled characters, you can go to www.2cto.com ~ /. Add the following content to the vimrc file: set encoding = UTF-8 fileencodings = ucs-bom, UTF-8, cp936, vim can automatically identify the file encoding (can automatically identify the UTF-8 or GBK encoding files), in fact, according to the fileencodings provided by the encoding list to try, if not find the appropriate encoding, it is opened in latin-1 (ASCII) encoding. Settings of the file www.2cto.com vimrc: 1 "character specify 2 set tags =/usr/local/tags 3 4" UTF-8 character 5 set encoding = UTF-8 6 set fileencoding = UTF-8: 7 set fileencodings = UTF-8, euc-jp, sjis, jis, ascii: 8 set ambiwidth = double 9 10 "too many variables have been inserted into our own memory limit 11 filetype plugin indent on 12 syntax enable 13 14" Basic settings 15 set nocompatible "vi mutual stop 16 set expandtab "タブ blank set 17 set tabstop = 4" タブ 18 set shiftwidth = 4 "インデント 19 19 19 19 set nu "The row number indicates 20 set showmode" specified parameter numbers indicates 21 "set backspace = 1" autoindent variable indicates modifying the line number. It may be 22 set backspace = indent, eol, start 23 set nowrap "24 set autoindent 25" set list 26 set smartcase 27 set r000028 set laststatus = 2 29 30 31 "タブの 32 set lcs = tab:>. 33 hi JpSpace cterm = underline ctermfg = Blue guifg = Blue 34 au BufRead, BufNew * match JpSpace // 35 36 "too many other than just starting 37 nnoremap <Space>.: <C-u> edit $ MYVI MRC <Enter> 38 nnoremap <Space> s.: <C-u> source $ MYVIMRC <Enter> 39 nnoremap, l: call PHPLint () <Enter> 40 41 "PHP has already been installed successfully when there are already 42 function PHPLint () 43 let result = system (& ft. '-l '. bufname ("") 44 echo result 45 endfunction 46 47 "manually append the subhandler 48" autocmd BufNewFile, BufRead *. ctp set filetype = php 49 set runtimepath = ~ Tkunimoto/. vim, $ VIMRUNTIME 50 autocmd BufNewFile, BufRead *. ctp set filetype = htmlcake 51