方案一:
网上流传的经典方案,但是说明的不是很详细,这里补充一下:
在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"
补充:
- 找到如下标签:
- <!-- compile the source code -->
- <javac destdir="${build.result.folder}/@dot" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bundleBootClasspath}" source="${bundleJavacSource}" target="${bundleJavacTarget}" >
- 修改为:
- <!-- compile the source code -->
- <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
转载于:https://blog.51cto.com/pep525/484246