在终端中输入如下命令,然后重新打开gedit即可:


    gsettings set org.gnome.gedit.preferences.encodings auto-detected "['GB18030', 'GB2312', 'GBK', 'UTF-8', 'BIG5', 'CURRENT', 'UTF-16']"

    gsettings set org.gnome.gedit.preferences.encodings shown-in-menu "['GB18030', 'GB2312', 'GBK', 'UTF-8', 'BIG5', 'CURRENT', 'UTF-16']"

更新到16.04,gedit打开中文时,依然存在乱码的问题。ubuntu官方给出的解决方案是,gedit3.x以上版本的在命令终端输入命令: 
gsettings set org.gnome.gedit.preferences.encodings auto-detected “[‘GB18030’, ‘UTF-8’, ‘CURRENT’, ‘ISO-8859-15’, ‘UTF-16’]” 来解决。 
但是输入命令后提示无”auto-detected”键值。 
看来键值真的是更改了,可以直接在dconf-editor下把”candidate-encodings”的值更改为”[‘GB18030’, ‘UTF-8’, ‘CURRENT’, ‘ISO-8859-15’, ‘UTF-16’]”。 

打开终端,在其中输入命令:

sudo dconf-editor

如果dconf-editor没安装,先使用sudo apt-get install dconf-editor 安装.

问题找到了,如果用命令进行更改的话,可以输入命令 

1. 打开终端,在其中输入命令:

sudo dconf-editor

如果dconf-editor没安装,先使用sudo apt-get install dconf-editor 安装。

2. 在新开的窗口里,在左边依次展开/org/gnome/gedit/perferences/encodings,修改其中的配置信息,在auto-detected项的value中的'UTF-8'后面添加, 'GB18030',在shown-in-menu对应值的后面添加上, 'GB18030'(注意逗号后面有个空格)。关闭然后再次运行Gedit即可生效。

gsettings set org.gnome.gedit.preferences.encodings candidate-encodings “[‘GB18030’, ‘UTF-8’, ‘CURRENT’, ‘ISO-8859-15’, ‘UTF-16’]” 来解决。

相关文章: