在eclipse rcp 使用utf-8編碼,調試運行都正常,在導出後運行出現中文亂碼問題, 查詢資料後作如下調整得以解決
1>打開plugin.xml,選擇build頁面,選中"Custom Build"複選框
2> 右鍵單擊build.properites文件,PDE tools --> Create Ant Build File
3>修改build.xml文件,添加javac參數encoding="UTF-8"
補充:
- 找到如下標籤:
-
- <javac destdir="${build.result.folder}/@dot" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bundleBootClasspath}" source="${bundleJavacSource}" target="${bundleJavacTarget}" >
-
- 修改爲:
-
- <javac destdir="${build.result.folder}/@dot" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bundleBootClasspath}" source="${bundleJavacSource}" target="${bundleJavacTarget}" encoding="UTF-8" >
4>重新導出工程,能正確顯示中文
OK!
方案二,直接在build.properties視圖下添加一行:
- javacDefaultEncoding.. = UTF-8