0

I have a Java program which prints Arabic text to Command prompt in windows. I read the text in three ways,

  • From Database
  • From file
  • From hard coded Arabic String

When I run the code from within the IDE (Intellij Idea) it works well i.e. prints the Arabic but it is not working when I run the program from Command prompt. I also print the character encoding, From IDE, the encoding is UTF-8 and from command prompt it is Cp1252. This is the problem. I also compiled and run the program using this command respectively,

javac -encoding UTF8 Testing.java
java -Dfile.encoding=UTF8 Testing

but this also didn't work. I also set an environment variable JAVA_TOOL_OPTIONS to -Dfile.encoding="UTF8" but still not working. Arabic is shown as ?????... Any help would be appreciated. Thanks

Sikander
  • 834
  • 2
  • 10
  • 33
  • Have you defined any specific font to be used in your application? – Switch May 08 '14 at 11:03
  • 1
    This isn't something you can fix on the Java side, it's the command prompt that would need to be configured with an appropriate encoding and a font that can display Arabic characters. Configuring Java to send UTF-8 won't help if the console isn't set up to expect it. – Ian Roberts May 08 '14 at 11:17

0 Answers0