Stanimir Stamenkov wrote:
> I've searched the archives but haven't found any useful information.
>
> I'm trying to change the encoding of the default 'System.out' output
> stream so I could see some international characters in the text console.
[...]
> So is it possible to change the encoding of the default 'System.out'?
Lookup the type of System.out: it is a PrintStream, which is a subclass
of OutputStream. OutputStreams are _byte_ streams. There is no
relevant concept of a character encoding. You can, however, do this:
PrintWriter out =
new PrintWriter(
new OutputStreamWriter(System.out, "Cp1251"));
[You will need to be prepared to handle an UnsupportedEncodingException.]
Thereafter write to your PrintWriter out, instead of directly to
System.out, and you should be in good shape. [Note that I make no
representation as to the console's ability to correctly display the
resulting byte stream; I assume you have that under control.]
John Bollinger