Gedit Chinese garbled characters

Source: Internet
Author: User

By default, garbled characters are displayed when you use the Ubuntu Text Editor (gedit) to open 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. All you need to do is add gb18030 to the matching list.

    • Command Line Method, applicable to all Ubuntu users.

Copy the following command to the terminal and press Enter:

Gconftool-2 -- set -- type = list -- list-type = string/apps/gedit-2/preferences/encodings/auto_detected "[UTF-8, current, gb18030, BIG5-HKSCS, UTF-16]"

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

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

    1. Press the Alt-F2 to open the run applicationProgram"Dialog box.
    2. In the text box, type "gconf-Editor" 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 until "gb18030" is at the top of the list.
    7. Click OK to close the configuration editor.

Gedit3.x version settings

Terminal input dconf-Editor

Expand ORG/gnome/gedit/preferences/encodings

Add 'gb18030' to the value of auto-detected and add it to the end of uft8;

Add 'gb18030' to the value of show-in-menu ′

Now, your gedit should be able to smoothly open the gb18030 encoded text file.

Command settings for gedit 3.x:Gsettings set Org. gnome. gedit. preferences. encodings auto-detected "['utf-8', 'gb18030', 'gb2312', 'gbk', 'big5', 'current', 'utf-16']"

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.