1

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 need 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!

Mazyod
  • 22,319
  • 10
  • 92
  • 157
  • Tell us what you mean by "I have set the workspace to support UTF-8", show us the code writing to the file, and tell us which tool and which font you use to view the contents of the file. – JB Nizet Feb 08 '11 at 14:11

1 Answers1

3

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");
trojanfoe
  • 120,358
  • 21
  • 212
  • 242
  • Didn't quite work, but somehow made me find this: [link](http://stackoverflow.com/questions/3033081/creating-utf-8-files-in-java-from-a-runnable-jar) ... Thanks. – Mazyod Feb 08 '11 at 14:25