[笔记]--Ubuntu下Gedit和VIM打开Windows下txt文件乱码解决
1、Gedit乱码
有些在Windows下能够打开的txt文件在Ubuntu下用gedit打开时,中文显示是乱码,这是因为编码方式不同造成的。Windows下默认txt文件的编码方式是GBk,而Ubuntu下的gedit默认没有对GBK的支持
解决方法:
1、在终端输入“dconf-editor”回车。(如果没有安装用“sudo apt-get install dconf-tools”安装。)
2、展开org/gnome/gedit/preferences/encodings
auto-detected的value中加入 'GBK', 加在uft8后面,按回车;
show-in-menu的value中在前面加入 'GBK', 'GB2312', 'GB18030', 按回车。
现在再打开txt等文本文件看看,乱码问题是不是解决了。
2、Vim乱码
在/etc/vim/vimrc文件后加入以下内容
set fileencoding=utf-8 set fileencodings=ucs-bom,utf-8,gb2312,gbk,gb18030 set termencoding=utf-8 set encoding=utf-8
参考文档:
- http://blog.chinaunix.net/uid-23392298-id-3338403.html
- http://www.cnblogs.com/xuxm2007/archive/2012/07/18/2556653.html
- http://forum.ubuntu.org.cn/viewtopic.php?f=50&t=146364
浙公网安备 33010602011771号