Trying to change the encoding of System.out, I created a PrintWriter with
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out, ENCODING));so
out.format("some text");
worked fine as for the encoding. But
out.checkError()didn't return true when the output stream was closed, e.g. by Unix 'head' command.
I've found that PrintStream offers a constructor with encoding
PrintStream out = new PrintStream(System.out, true, ENCODING);
and the checkError() worked fine for this class.
I doubt the PrintWriter case is a bug, or am I missing something?