Forums Register Login
platform's default character encoding
Hi all.
How can I get the platform's default character encoding ?
From Sun's Java site:
You can query an InputStreamReader or OutputStreamWriter (these are the classes that "bridge" byte streams to character streams), for its character encoding.
For example:

Now you have a String representation of the encoding.
This example would work in an applet too:

Please change your name to be compliant with JavaRanch's naming policy.
Your displayed name should be 2 separate names with more than 1 letter each. We really would prefer that you use your REAL name.
You can change your name: here.
On many systems, it's possible to get the default encoding thus:
However this is not guaranteed to work on all systems. The simplest way I know that is guaranteed is
new OutputStreamWriter(System.out).getEncoding()

This thread has been viewed 1438 times.

All times above are in ranch (not your local) time.
The current ranch time is
Dec 15, 2018 06:47:20.