0

I have my code to check encoding table:

System.out.println("enc. table: "+System.getProperty("file.encoding") +
          "enc. table: "+new java.io.OutputStreamWriter(new java.io.ByteArrayOutputStream()).getEncoding() + 
          "enc. table:" + java.nio.charset.Charset.defaultCharset().name());

When I start my from windows I get text file with cp1250, when I start from my embedded system I get text file with cp852. In windows I have set code page 852. In Eclipse I have set cp852. Some solution?

Gareth Davis
  • 27,701
  • 12
  • 73
  • 106
Ballon
  • 6,882
  • 18
  • 49
  • 63
  • possible duplicate of [Platform default character encoding](http://stackoverflow.com/questions/5581985/platform-default-character-encoding) – jtahlborn Jun 22 '11 at 12:32
  • How to change all this settings grammatically from java. Is that possible? – Ballon Jun 23 '11 at 09:09
  • you don't need to change it. all the jdk classes which require an encoding allow you to specify it manually. (and you can't reliably change the default value at runtime). – jtahlborn Jun 23 '11 at 12:40

1 Answers1

0

You should really be specifing the required encoding on the OutputStreamWriter.

new OutputStreamWriter(outstream, "cp852");

You may also want to read Joels article The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets

Gareth Davis
  • 27,701
  • 12
  • 73
  • 106