RFR: 8352906: stdout/err.encoding on Windows set by incorrect Win32 call [v2]
Alan Bateman
alanb at openjdk.org
Thu Mar 27 07:39:19 UTC 2025
On Wed, 26 Mar 2025 20:57:47 GMT, Naoto Sato <naoto at openjdk.org> wrote:
>> Those system property values on Windows were derived from Windows' `GetConsoleCP()` call, but they should have been taken from `GetConsoleOutputCP()`. Replacing the incorrect call with the correct one won't change any behavior, as both calls return the same value by default (`GetOEMCP()`). However, it is still the right thing to do.
>
> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
>
> Reflects the review comment
Marked as reviewed by alanb (Reviewer).
src/java.base/windows/native/libjava/java_props_md.c line 142:
> 140: cp = GetConsoleOutputCP();
> 141: } else {
> 142: cp = GetConsoleCP();
Just a reminder that we should handle the case where GetConsoleXXX returns 0 for error. We've seen bugs where "cp0" is used and I think this suggests that it must fail in some environments.
-------------
PR Review: https://git.openjdk.org/jdk/pull/24263#pullrequestreview-2720132565
PR Review Comment: https://git.openjdk.org/jdk/pull/24263#discussion_r2015833529
More information about the core-libs-dev
mailing list