开发者

Exporting runnable JAR file does not support UTF-8 encoding - Java Eclipse

I made this small Java program using eclipse IDE. I have set the workspace to support UTF-8 and the program runs happily when executed from eclipse.

Part of the program is that it writes some data to a file (needs UTF-8, since its in Arabic).

I n开发者_运维知识库eed to export a runnable JAR file to give my client this program...

My Problem:

When I export the program using "Export to Runnable JAR file", it runs perectly, BUT the data, written in Arabic, to the file ends up being question marks >.< .. This problem does not happen if I compile and run directly from eclipse!

Any idea on how to solve this?

Could you suggest another way to distribute my program??

Thanks!


You don't mention the classes you use to write to file, but have you tried setting the encoding explicitly?

For example:

Writer out = new OutputStreamWriter(fos, "UTF8");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜