[8.0.0] Force the JVM to use UTF-8 on Windows #24231
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change patches the app manifest of the
java.exe
launcher in the embedded JDK to always use the UTF-8 codepage on Windows 1903 and later.This is necessary because the launcher sets sun.jnu.encoding to the system code page, which by default is a legacy code page such as Cp1252 on Windows. This causes the JVM to be unable to interact with files whose paths contain Unicode characters not representable in the system code page, as well as command-line arguments and environment variables containing such characters.
The Windows VMs in CI are not running Windows 1903 or later yet, so this change can currently only be tested locally by running
bazel info character-encoding
and verifying that it printssun.jnu.encoding = UTF-8
.Work towards #374
Work towards #18293
Work towards #23859
Closes #24172.
PiperOrigin-RevId: 693466466
Change-Id: I4914c21e846493a8880ac8c6f5e1afa9fae87366
Commit 7bb8d2b