RFC: System.console().encoding()

Dawid Weiss dawid.weiss at gmail.com
Thu Sep 15 06:55:45 UTC 2016

+1 for adding a public Console.encoding(). I remember needing it as
well, the current hacks are very ugly.


On Thu, Sep 15, 2016 at 8:42 AM, Aleksey Shipilev <shade at redhat.com> wrote:
> Hi,
> Claes pointed out that our own reflective hacks to figure out console
> encoding do not work anymore [1]. But, we need the console encoding for
> reliably printing on the console from within different sources. Note
> that you would normally just use System.console() and its PrintWriter,
> but reality is a bit more complicated, and sometimes you need to write
> the plain char stream directly into the byte[]-accepting methods,
> encoding on your own.
> So, my question: should we, in the light of extended Jigsaw-solving
> crunch, provide the public Console.encoding() method that would return
> the console charset?
> Thanks,
> -Aleksey
> [1]
> http://mail.openjdk.java.net/pipermail/jmh-dev/2016-September/002330.html

More information about the core-libs-dev mailing list