How to solve vim and gedit Chinese garbled characters in Ubuntu

Source: Internet
Author: User

To try the English version, you need to solve the problem of Chinese support in many software programs. Vim has been used for a long time. When gedit is used occasionally, there is a problem in Chinese. Today, it cannot be solved simply.

In fact, gedit uses an encoding matching list. Only the encoding in this list will be matched. Encoding not in this list will be garbled. All you need to do is add gb18030 to the matching list.

The following is from wiki. Ubuntu:

* Graphical mode, applicable to Ubuntu users, but not kubuntu/xubuntu users.

 

Follow these steps to make your gedit correctly display the Chinese encoding file.

 

1. Press the Alt-F2 to open "Run ApplicationProgram"Dialog box. Or run gconf-editor on the terminal.

2. Type "gconf-Editor" in the text box and press the Enter key to open "configuration Editor ".

3. Expand the tree node on the left, find the/apps/gedit-2/preferences/encodings node, and click it.

4. Double-click the auto_detected key on the right to open the "Edit key" dialog box.

5. Click "add" on the right of the list, enter "gb18030", and click "OK.

6. A "gb18030" is added at the bottom of the list ". Click Select it, and click the "up" button on the right

"Gb18030" is located at the top of the list. Then add GBK.

7. Click OK to close the configuration editor.

 

Now, gedit should be able to smoothly open gb18030, GBK and other encoded text files.

 

By the way, the vim configuration file is modified to support Chinese characters.

 

--> Sudo CP/etc/Vim/vimrc. Bak

--> Sudo Vim/etc/Vim/vimrc

 

Add

 

"Added by me for zhongwen luanma, start.

Set fileencodings = UTF-8, gb2312, GBK, gb18030

Set termencoding = UTF-8

Set encoding = PRC

"Added by me for zhongwen luanma, end.

 

Save and exit. Now Vim displays Chinese correctly.

 

This article Reprinted from http://blog.chinaunix.net/u3/112651/showart_2227938.html

 

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.