您的位置:首页 > 其它

最简单方法解决RCP程序UTF-8编码问题

2013-07-05 15:51 441 查看
方案一:

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

在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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐