Skip to content

Make exe fully Unicode #11214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sergeevabc opened this issue May 16, 2025 · 3 comments
Open

Make exe fully Unicode #11214

sergeevabc opened this issue May 16, 2025 · 3 comments
Assignees
Labels

Comments

@sergeevabc
Copy link

sergeevabc commented May 16, 2025

Windows 7 SP1 x64, GraalVM 24, MSVC 14.36.17.6, SDK 26100.

Source: crip.jar

$ chcp
Active code page: 866

$ java -jar crip.jar export pem -u=https://yahoo.com
Exported 3 certificates to C:\Проверка

$ chcp 1251

$ java -jar crip.jar export pem -u=https://yahoo.com
Exported 3 certificates to C:\Проверка

$ chcp 65001

$ java -jar crip.jar export pem -u=https://yahoo.com
Exported 3 certificates to C:\Проверка

Great! Now let's compile that jar and see what happens.

$ native-image --no-fallback -march=compatibility -Ob --enable-http --enable-https -jar crip.jar
(success)

$ chcp
Active code page: 866

$ crip.exe export pem -u=https://yahoo.com
Exported 3 certificates to C:\╨Я╤А╨╛╨▓╨╡╤А╨║╨░

$ chcp 1251

$ crip.exe export pem -u=https://yahoo.com
Exported 3 certificates to C:\Проверка
 
$ chcp 65001

$ crip.exe export pem -u=https://yahoo.com
Exported 3 certificates to C:\Проверка

The output is correct only when chcp 65001 is specified. What can be done to ensure that the output of the compiled exe is the same with any chcp, as is the case with Java? In other words, how can I force native-image to add support for all code pages to exe?

Related:

@selhagani
Copy link
Member

Hi @sergeevabc,

Thank you for reaching out to us about this.

Would you mind uploading a reproducer to a GitHub repository? That would allow me to test it on my end. Unfortunately, downloading JAR files directly is against our policy.

@sergeevabc
Copy link
Author

sergeevabc commented May 19, 2025

Would you mind uploading a reproducer to a GitHub repository?

A reproducer? You mean a minimal working example? But I am an ordinary user, not a developer, who can trim the specified app to the required state. @Hakky54, it's your toy and you have skills, could you post some helloworld-like short piece of code that does nothing but prints “Certificates exported to [PATH]” to show these Oracle guys with policies what happens with Unicode in native-image generated Windows binaries?

@Hakky54
Copy link

Hakky54 commented May 19, 2025

So @sergeevabc discovered this issue when using certificate ripper. This tool can extract server certificates from the CLI. To reproduce the issue follow these steps:

  1. Use Windows, any version is fine
  2. Make a directory in the root (C:/) directory, name it: Проверка
  3. Clone the project, https://github.com/Hakky54/certificate-ripper.git in the root directory (C:/)
  4. cd to certificate ripper
  5. run mvn clean install -DskipTests -Pnative-image
  6. In command line go to directory C:\Проверка
  7. run the following command: cmd /K ..\certificate-ripper\target\crip.exe export pem -u=https://google.com

Analyse the output.
The actual output will be something like this:

Exported 3 certificates to C:\Проверка

but the actual output is:

Exported 3 certificates to C:\????????

It seems that GraalVM has trouble displaying the Cyrillic script.
During our investigation, which you can find here: Hakky54/certificate-ripper#76 we found out that the default charset is windows-1252 when building the native image. I managed to change that to UTF-8, however it was still not able to display the correct text. Setting it to UTF-8 gave the following output:

Exported 3 certificates to C:\ðƒÐÇð¥ð▓ðÁÐÇð║ð░

With just Java it is showing the foldername correctly. With native compiled executable it is failing to show the correct foldername even when the default charset is set to UTF-8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants