ubuntu下eclipse GB编码问题
在Windows下用eclipse工作,因为Windows本身使用GB编码,所以大部分代码也是GB编码,为了方便eclipse工程拷贝,因此在Ubuntu下的eclipse也使用GB编码,而Ubuntu默认没有GBK和GB2312编码,需要进行配置才可以使用。
- 修改Ubuntu配置文件 /var/lib/locales/supported.d/local:
sudo gedit /var/lib/locales/supported.d/local
增加两行:
zh_CN.GBK GBK
zh_CN.GB2312 GB2312
- 更新配置
sudo dpkg-reconfigure --force locales
修改Eclipse设置:
工程->Properties->Resource->Text file encoding->Other中直接输入GBK或GB2312。