How do we know which charset the OS is using? For example, I know that Japanese Windows 95 encoding is MS932, but how do we know which charset it uses?
The bad news is that both these methods give the encoding used by Windows api and not the encoding used by a command window. Usually these two character sets are different (you can change this, at least on Windows NT). There is no way in Java to determine the codepage being used by the current command window (if any) unless you use JNI. For example, on my system the Windows codepage is 1252, while the default command window code page is 850.