I know we can set the Charset of a PrintStream like this:
PrintStream printStream = new PrintStream( System.out, true, StandardCharsets.UTF_8.name() ); // "UTF-8".
Is there a way to get the Charset being used by a PrintStream object such as System.out? Something like this:
Charset charset = System.out.getCharset() ;
…but I cannot find any such getter on PrintStream.
This Question was raised while addressing a mystery in this Question.
You should use reflection API like this.
output:
You need to pay attention to the last WARNING message.
I found the field
charOutin my eclipse debugger.