I can not display file coded with GBK. In gconf-editor of gnome 3.2 , I can not find encoding item of gedit . How to set it ? thanks

  • What is the output of locale and locale -a?
    – enzotib
    Jan 24, 2012 at 8:58

3 Answers 3


I don't have a file encoded in GBK to test the solutions, but do try them.

Option 1: Run gedit and then open the file:

  • run gedit

  • click open

  • select in the encoding combo "add" and add GB18030 (or GBK)

  • select that encoding in the combo

  • select the file

Option 2:

  • install and run gconf-editor

  • Find /apps/gedit-2/preferences/encoding key "auto_detected" and set it to:


Remember to backup the previous value of auto_detected!!

Option 3: Using dconf (the "newer" gconf, used in ubuntu)

dconf read /org/gnome/gedit/preferences/encodings/auto-detected

Save the result (backup)!

dconf write /org/gnome/gedit/preferences/encodings/auto-detected "['CURRENT', 'GBK', 'GB18030', 'GB2312', 'UTF-8', 'UTF-16']"


To reset it to default: a) use the option you backed up from dconf read command

or b) try:

dconf reset /org/gnome/gedit/preferences/encodings/auto-detected
  • Unexpected error: Invalid byte sequence in conversion input Mar 31, 2016 at 6:26

If you want do it quick then install medit. All works from the box.

If you still want use gedit then you need do some work:

  1. Set auto-detect

    gsettings set org.gnome.gedit.preferences.encodings auto-detected "['UTF-8', 'GBK', 'CURRENT', 'ISO-8859-15', 'UTF-16']"
  2. Install plugin for manual choose encoding. Really useful, especially when auto-detect don't detect encoding properly

"Change encoding" plugin for gedit v3

# Download plugin
mkdir -p /tmp/encoding
cd /tmp/encoding
wget https://aur.archlinux.org/packages/ge/gedit-encoding-plugin/gedit-encoding-plugin.tar.gz
tar -xzvf gedit-encoding-plugin.tar.gz

# Copy to plugins directory
mkdir -p ~/.local/share/gedit/plugins
cp /tmp/encoding/gedit-encoding-plugin/encoding.plugin /tmp/encoding/gedit-encoding-plugin/encodingpy.py ~/.local/share/gedit/plugins

# Remove /tmp/encoding
rm -Rf /tmp/encoding

Then run gedit. Choose Edit->Preferences->Plugins(tab)->Check "Encoding" checkbox. After you do that you can find "Encoding" in menu "File"

Plugin description: https://aur.archlinux.org/packages/gedit-encoding-plugin/

Plugin for gedit v2. Same author as in plugin above: http://bugzilla.gnome.org/attachment.cgi?id=108326 (this is .tgz ext, but be careful it is a tar only archive) or plugin for gedit v2 by another author: http://petrstepanov.wordpress.com/2010/09/29/gedit-encoding-plugin/

!!! plugin for gedit v2 has got tar.gz ext, but it is only a tar archive that is not gzipped...


Ubuntu 18.10 gconf-editor is removed. Use 'dconf-editor' as an instead.Or use command line tool 'dconf'. And 'auto-detected' is replaced by 'candidate-encodings' :

dconf write /org/gnome/gedit/preferences/encodings/candidate-encodings "['CURRENT', 'GBK', 'GB18030', 'GB2312', 'UTF-8', 'UTF-16']"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.