Eclipse console乱码

转自:eggboss

"這真是個很討厭的問題,當我所有的設定都設成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!

目前發現是 JDK的問題:

a.若是用JDK1.4那console得設定成big5才行!

b.若是用JDK6,那用UTF-8就沒問題!

猜你喜欢

转载自blog.csdn.net/hgd95/article/details/84973417