On Wed, 21 May 2025 16:48:20 GMT, Naoto Sato <na...@openjdk.org> wrote:

>> src/java.base/share/classes/java/io/Console.java line 67:
>> 
>>> 65:  * stdout.encoding}, in which case read operations use the {@code 
>>> Charset}
>>> 66:  * designated by {@code stdin.encoding}.
>>> 67:  * <p>
>> 
>> `Console.charset()` states "The returned charset is used for interpreting 
>> the input and output source (e.g., keyboard and/or display) specified by the 
>> host environment or user, which defaults to the one based on 
>> stdout.encoding." If _stdin.encoding_ is set otherwise, this is no longer 
>> true, so I think this method may need a wording update as well.
>
> Good point. Brought the same wording to the `charset()` method description 
> for further clarification.

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.

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

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

Reply via email to