RFR: 8356985: Use "stdin.encoding" in Console's read*() methods [v2]

Naoto Sato naoto at openjdk.org
Thu May 22 17:48:53 UTC 2025


On Thu, 22 May 2025 16:39:46 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> I'm confused by the actual behavior here. What might be helpful is to divide the discussion between a) what charsets get used for input and output, and b) the return value of the `charset()` method.
>> 
>> I'm not entirely sure, but since `stdin.encoding` and `stdout.encoding` are always set to something -- whether it comes from the platform or the command line -- won't Console just use `stdin.encoding` for input and `stdout.encoding` for output? If this is true, maybe just say this instead of deferring to the `charset()` method.
>
> I think I agree with Stuart and it would be better to say that stdin.encoding is used for reading, and stdout.encoding for writing. They are usually the same but if they differ then Console will return the charset for output.

Thanks. I reworded the descriptions of the class and `charset()` method.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25271#discussion_r2103101604


More information about the core-libs-dev mailing list