When we want to view the file in Ubuntu11.10 terminal, we use the vi or cat command to view the file and find that the file does not support Chinese characters, such as/home/XXXX/liunx.txt. garbled characters are displayed by default, the solution is as follows: 1) It is effective for all users and solves the problem of user vi Chinese garbled characters in the system sudogedit/etc/vim/vimrc. tiny adds the following content: # the content of this file is shown as follows: "Encodingrelatedsete
When we want to view the file on the Ubuntu 11.10 terminal, we can use the vi or cat command to view the file and find that the file does not support Chinese characters very well.
For example,/home/XXXX/liunx.txt, garbled characters are displayed by default. The solution is as follows:
1) It is effective for all users and solves the problem of garbled vi Chinese characters of users in the system.
Sudo gedit/etc/vim/vimrc. tiny
Add the following content:
# The file content is displayed as follows:
"Encoding related
Set encoding = UTF-8
Set langmenu = zh_CN.UTF-8
Language message zh_CN.UTF-8
Set fileencodings = ucs-bom, UTF-8, cp936, gb18030, big5, euc-jp, euc-kr, latin1
Set fileencoding = UTF-8
2) only effective solutions for current users
By default, ubuntu does not have a. vimrc file in the home directory of the current user. In this case, you can touch a. vimrc file and add it to it.
# The file content is displayed as follows:
"Encoding related
Set encoding = UTF-8
Set langmenu = zh_CN.UTF-8
Language message zh_CN.UTF-8
Set fileencodings = ucs-bom, UTF-8, cp936, gb18030, big5, euc-jp, euc-kr, latin1
Set fileencoding = UTF-8
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2