Eclipse console亂碼問題

来源:互联网 发布:办公自动化软件包括 编辑:程序博客网 时间:2024/05/17 05:08

這真是個很討厭的問題

當我所有的設定都設成UTF-8的時候

偏偏console怎麼搞都是亂碼

 

後來才發現當java檔編碼設為BIG5時就正常了…

這不是我要的!

 

再後來發現這篇

Eclipse 執行時如何讓Console顯示中文

Eclipse主功能表-->Run-->Run Configuration-->Common 頁籤-->

Console Encoding-->Others-->big5 (沒有就手動輸入)-->Apply

 

最後是印出正常的中文,但是這代表JDK應該是自己把它變成BIG5

所以導至設定成UTF-8的Console會印出亂碼!

 

建置全UTF-8的環境:

1.在eclipse.ini的-vmargs下面加上「-Dfile.encoding=UTF-8」。

2.eclipse-->Window-->Preferences-->General-->Workspace-->Text file encoding-->UTF-8

3.Installed JREs-->Default VM Arguments:-->-Dfile.encoding=UTF-8

4.eclipse-->Run-->Run Configurations-->Arguments-->VM arguments-->-Dfile.encoding=UTF-8

5.eclipse-->Run-->Run Configuration-->Common 頁籤--> Console Encoding-->Others-->UTF-8

==>亂碼!

5.eclipse-->Run-->Run Configuration-->Common 頁籤--> Console Encoding-->Others-->big5

==>ok!

 

引用:http://eggboss.javaeye.com/blog/639841