On Thu, 22 Apr 2021 15:42:02 GMT, Naoto Sato <na...@openjdk.org> wrote:
>> src/java.base/share/classes/java/io/Console.java line 597: >> >>> 595: return null; >>> 596: } >>> 597: }); >> >> Please keep the charset() method and return CHARSET. >> >> I'm looking at a use case that needs to know the platform charset regardless >> of whether the console exists. >> When a process is launched it may be redirected to /dev/tty or a pseudo tty >> and in that case >> a Reader from that stream should be able to use the encoding of the platform. >> Its still a work in progress, but it would save some refactoring or >> duplication later. > > Would the singleton `Console.cons` be instantiated in your use case? It is > created only when isatty() (or Windows' equivalent) in the native code > returns true. Not always, for example, if stderr was redirected to a terminal but not stdin and stdout. The istty check is only true if both stdin and stdout are ttys. ------------- PR: https://git.openjdk.java.net/jdk/pull/3419