Ubuntu11.10 solves file garbled characters in Vi including Chinese Characters

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.