This section provides a tutorial example on how to run the character encoding sample program with CP1252 encoding for character value range of 0x0000 - 0x00FF.
First, let's run my sample program, EncodingSampler.java, without any argument will use the JVM's default encoding:
The default encoding of the String class seems to be the same as OutputStreamWriter: Cp1252.
There are a number of characters that can not be encoded by Cp1252.
The String, OutputStreamWriter, and Charset classes are returning 0x3F
for those non-encodable characters.
It's obvious that Cp1252 works on a character set in the 0x0000 - 0x00FF range.
To confirm that JDK default encoding is Cp1252, let's running the sample program again
with 'CP1252' as argument. The result should be the same as the previous test: