On Sun, 27 Apr 2025 10:51:33 GMT, Jan Lahoda <jlah...@openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/IO.java line 192:
>> 
>>> 190:             String enc = System.getProperty("stdin.encoding", "");
>>> 191:             Charset cs = Charset.forName(enc, StandardCharsets.UTF_8);
>>> 192:             br = new BufferedReader(new InputStreamReader(System.in, 
>>> cs));
>> 
>> I suspect we need to fall back to `stdout.encoding` first before UTF-8 
>> especially for Windows if Java does not set `stdin.encoding` automatically 
>> when launched.
>
> I believe that after:
> https://github.com/openjdk/jdk/pull/24738
> the `stdin.encoding` property is set when the process is connected to a 
> console, which is probably the main case where the encoding can be detected 
> automatically.

I misunderstood that I have tested `stdin.encoding`.
I cannot confirm that `stdin.encoding` is changed in Windows to proper ones 
because it has not been included in the latest EA build (20) and I cannot build 
master for Windows. However, it is changed to `US-ASCII` in Ubuntu when I 
change `LANG`. I will believe its author until the latest EA build is updated.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24438#discussion_r2062641495

Reply via email to