0


I'm writing a java app that should support multiple languages. The text is already available in different languages. it is unknown in advance.
In case i print it to System.out or to a log or to a socket it appears as question mark (?) when running on Ubuntu server.
Running on my local windows machine it works. in both cases i didn't change the file.encoding but using the system defaults (isn't it "UTF-8" for java if its not set?)
I assume its related to encoding but need your help.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
fredy
  • 575
  • 2
  • 9
  • 20
  • "In case i print it..." - what is "it"? How exactly did you implement the support for multiple languages? Show your code. Right now, your question contains too little information for someone to give you a useful answer. The default character encoding is not always UTF-8, it depends on the system (and on Windows it is most likely not UTF-8). – Jesper Jun 15 '15 at 10:43
  • on ubuntu the follwoing code: System.out("שלום"); // display as ???? – fredy Jun 15 '15 at 10:46
  • Do you hold all translations in properties files? – Arek Jun 15 '15 at 10:58
  • 1
    The default is not UTF-8: http://stackoverflow.com/questions/1006276/what-is-the-default-encoding-of-the-jvm – selalerer Jun 15 '15 at 11:12
  • i'm getting the String text from socket (read fine). Trying to set the following didn't work: System.setProperty("file.encoding", "UTF-8"); – fredy Jun 15 '15 at 18:57

1 Answers1

0

adding jvm argument: -Dfile.encoding="UTF-8" worked

fredy
  • 575
  • 2
  • 9
  • 20