Reason: eclipse
(Windows下的Eclipse默认会去读取系统的编码,因此Widnwos下的Eclipse的编码为GBK),而Ubuntu默认是不支持GBK编码的。 编码
Solution: spa
1.让Ubuntu支持GBK
修改/var/lib/locales/supported.d/local文件,在文件中添加
zh_CN.GBK GBK
zh_CN.GB2312 GB2312
sudo dpkg-reconfigure --force locales ip
在输出的结果中会出现
zh_CN.GB2312 done
zh_CN.GBK done
这样, Ubuntu就支持GBK编码了, io
2.设置eclipse
Menu-> Windows->Preferences->General->Workspace.
Text file encoding->Other 选择GBK, (没有GBK的选项的直接输入GBK三个字符),
Apply, GBK编码的中文, Done! cli