[GR-60338] [Native Image] sun.jnu.encoding
defaults to legacy code page on Windows
#10237
Open
1 task done
Labels
Describe the Issue
The
Charset
used for filesystem operations (e.g. to encode/decode paths) is determined by thesun.jnu.encoding
system property, which is inherited from the build time environment. On Windows, this defaults to the current code page (as determined by a call toGetACP()
), which usually results in a legacy encoding such asCp1252
that doesn't support most Unicode characters. The only way to work around this is to force the system code page to be UTF-8, which is still considered a beta feature and can break other apps.Using the latest version of GraalVM can resolve many issues.
GraalVM Version
Oracle GraalVM 23.0.1+11.1
Operating System and Version
Windows 10 x86
Build Command
Any image build
Expected Behavior
System.getProperty("sun.jnu.encoding")
returnsUTF-8
by default or there is a build-time option to choose this encoding.Actual Behavior
System.getProperty("sun.jnu.encoding")
returnsCp1252
and operating on filesystem paths with non-ASCII Unicode characters results inInvalidPathException
s.Steps to Reproduce
System.getProperty("sun.jnu.encoding")
from any image build on Windows with default settings.Additional Context
Individual applications can opt into a UTF-8 code page: https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page#set-a-process-code-page-to-utf-8
It may be sufficient to add such a manifest to the
native-image.exe
binary.Build Log Output and Error Messages
No response
The text was updated successfully, but these errors were encountered: