Change Default-Encoding in jvm.cfg

  • Thread starter henning.schnieder
  • Start date
H

henning.schnieder

Hi Experts,

I am new with Java. Within an integration I get strange behaviour
caused of different Codepages of the server and the clients. Is it
possible to enter a default for the property "file.encoding" in the
file "jvm.cfg" and what is the syntax?

Thanks in Advance
 
G

Gordon Beaton

I am new with Java. Within an integration I get strange behaviour
caused of different Codepages of the server and the clients. Is it
possible to enter a default for the property "file.encoding" in the
file "jvm.cfg" and what is the syntax?

Exactly what "strange behaviour" are you experiencing?

Any software that depends on the default encoding being correct is
implicitly broken, for distributed applications even more so. You
should code your application to use the encoding it needs, regardless
of any local defaults.

Here's a possible clue: instead of using FileReader/Writer, use
InputStreamReader/Writer which let you specify the encoding.

/gordon

--
 
M

Marcelo Morales

Exactly what "strange behaviour" are you experiencing?

Any software that depends on the default encoding being correct is
implicitly broken, for distributed applications even more so. You
should code your application to use the encoding it needs, regardless
of any local defaults.

Here's a possible clue: instead of using FileReader/Writer, use
InputStreamReader/Writer which let you specify the encoding.

/gordon

--

Hi

I agree with Gordon. _Never_ rely on default encoding being right.

I'm no expert, but a seasoned programmer. Encoding has always been a
pita for me, regardless of programming language, platform or os. Since
the introduction of nio, Java has become stronger imho.

java.nio.charset.Charset.availableCharsets().keySet() should give you
a nice list of supported encodings. It might differ from one platform
to another and from one jvm to the next (check out MacRoman). You can
set the default java encoding using the file.encoding property.

Marcelo Morales
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top