Ubuntu terminal vi and gedit Chinese garbled solution

Source: Internet
Author: User
(1) how to solve the gedit Chinese garbled problem: by default, when the Ubuntu text editor (Ggedit) opens a Chinese-encoded text file of the GB18030/GBK/GB2312 type, garbled characters will appear. The reason for this is that gedit uses a list of encoding matches, only...

 

(1) how to solve the Chinese garbled characters in gedit:

By default, garbled characters will appear when the Ubuntu text editor (Ggedit) opens Chinese-encoded text files of the GB18030, GBK, and GB2312 types. This is because gedit uses an encoding matching list. only the encoding in this list is matched. encoding not in this list is garbled. You only need to add GB18030 to this matching list to solve the garbled text problem. The solution is as follows:

1. command line

Gconftool-2 -- set -- type = list -- list-type = string/apps/gedit-2/preferences/encodings/auto_detected "[UTF-8, CURRENT, GB18030, BIG5-HKSCS, BIG5, UTF-16] "" needs to change the encoding order, as needed.

2. graphical mode, applicable to Ubuntu users, not KUbuntu/XUbuntu users

The procedure is as follows:

1) press the Alt-F2 to open the run Application dialog box, type gconf-editor to open the configuration editor ".

2) expand the tree node on the left, find the/apps/gedit-2/preferences/encodings node, and click it; double-click the auto_detected key on the right, and click the Add button on the right of the list, enter "GB18030" and click OK. A "GB18030" is added at the bottom of the list ". Click select it, and click the "up" button on the right until "GB18030" is at the top of the list. "After the change, change the order back as needed ~

 

(2) vim Chinese garbled problem solution:

Open the vim configuration file at/etc/vim/vimrc and add

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

Set termencoding = utf-8 "changed to another one as needed

Set encoding = prc

Save and exit. now vim displays Chinese correctly.

 

Author mr_yqs

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.