How do I set a default character encoding for file I/O operations, JDBC requests and so on?

Sandip Chitale

The default encoding used by locale/encoding sensitive API in the Java libraries is determined by the System property "file.encoding". This system property is initialized by the JVM startup code after querying the underlying native operating system. For example on my English USA NT box it is initialized to:

It is generally recommended that you do not modify it. However if you know what you are doing you could override the system property either on the command line using the -

java -Dfile.encoding=...

syntax or programmatically at startup.

Here is the reference URL for supported encodings -

You may also find Sun's online tutorial helpful: