Ubuntu下gedit打开Windows文本乱码问题的解决方法

February 11th, 2009 (1,712 views)

有些在Windows下能够打开的txt文件在Ubuntu下用gedit打开时,中文显示是乱码,这是因为编码方式不同造成的。Windows下默认txt文件的编码方式是GBk,而Ubuntu下的gedit默认没有对GBK的支持。解决方法有三:

1. 用gedit -h看一下可以知道gedit里面有一个选项是--encoding,在终端中运行gedit --encoding=gbk filename,这时打开文件看到的中文就不是乱码了;

2. 先打开gedit,然后在打开文件时,在Character Coding下拉菜单里选择GBK或GB18030就可以了;

3. 在终端运行gconf-editor,在apps -> gedit-2 -> preference -> encodings里面有个auto-detect,在它的前面加上GBK或GB18030就OK了。

Related Posts

Leave a Reply

Security Code: