Ubuntu下如何设置Eclipse支持GBK和GB2312编码

来源:互联网 发布:淘宝卖男装的店铺 编辑:程序博客网 时间:2024/04/30 23:41

在Ubuntu下安装Eclipse,默认没有GBK和GB2312编码,有些工程中的文件打开以后就会出现乱码。

解决方案如下:
1. 修改Ubuntu配置文件 /var/lib/locales/supported.d/local:
    sudo gedit /var/lib/locales/supported.d/local
    增加两行:
    zh_CN.GBK GBK
    zh_CN.GB2312 GB2312
2. 更新配置:
    sudo dpkg-reconfigure --force locales
3. 修改Eclipse设置:
    工程->Properties->Resource->Text file encoding->Other中直接输入GBK或GB2312
这时重新打开已经不是乱码了。