Ubuntu in the use of vim to open txt and other documents Chinese display garbled solution

Source: Internet
Author: User

Tonight with the Ubuntu 12.04 vim to edit the page code, found that the above Chinese display garbled. This HTML file is I previously edited with Gedit, in gedit inside display normal, but in vim under the display is garbled.

How to solve the problem of vim display Chinese garbled in Ubuntu? First, add the Chinese character encoding: sudo gedit/var/lib/locales/supported.d/local in the open file to add the following ZH_CN. GBK GBK ZH_CN. GB2312 GB2312 ZH_CN. GB18030 GB18030 then enter the following command to make it effective: sudo dpkg-reconfigure locales next is to modify the vim configuration file sudo gedit/etc/vim/vimrc add the set Fileencodin in the back gs=utf-8,gb2312,gbk,gb18030 set Termencoding=utf-8 set ENCODING=PRC after saving, re-open vim will be able to display the normal Chinese.

Ubuntu in the use of vim to open txt and other documents Chinese display garbled solution

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.