方案一:

网上流传的经典方案,但是说明的不是很详细,这里补充一下:

在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"

 

补充: 
 
  

  1. 找到如下标签: 
  2. <!-- compile the source code --> 
  3.         <javac destdir="${build.result.folder}/@dot" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bundleBootClasspath}" source="${bundleJavacSource}" target="${bundleJavacTarget}"  > 
  4.  
  5. 修改为: 
  6. <!-- compile the source code --> 
  7.         <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视图下添加一行:

 

 
  
  1. javacDefaultEncoding.. = UTF-8