您的位置:首页 > 其它

Ubuntu gedit 中文乱码解决方法

2013-04-01 19:42 363 查看
有些在Windows下能够打开的txt文件在Ubuntu下用gedit打开时,中文显示是乱码,这是因为编码方式不同造成的。Windows下默认txt文件的编码方式是GBK,而Ubuntu下的gedit默认没有对GBK的支持。解决方法如下:

在终端运行gconf-editor,(如果没有安装用“sudo apt-get install dconf-tools”安装。)

在apps -> gedit-2 -> preference -> encodings里面有个auto-detect,在它的前面加上

GBK或GB18030就OK了。

PS:使用的时候,我的preference的目录下面就是没有encodings的选项,因此改用一下方案:

打开终端输入:

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']"

此时,重新打开gedit文件,没有中文乱码。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: