-
Notifications
You must be signed in to change notification settings - Fork 19
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
Help text has wrong encoding when "Beta: Use Unicode UTF-8 for worldwide language support" is enabled #43
Comments
Hi @everything411 - If this is also occurring with AdoptOpenJDK then the likely issue is with OpenJDK itself (or some common configuration that you need to set). We'll see if we can reproduce and advise on next steps (or submit an upstream issue on your behalf). |
@gdams could you take a look into this please and verify if this also occurs on Adoptium? |
fixed in latest Adoptium JDK17-beta. still wrong encoding for Adoptium JDK16 JDK11 and JDK8 |
@everything411 could you please check if this happens with the MS Build of OpenJDK binaries? Which versions the problem appears, which don't? |
MS Build of OpenJDK 17: the problem don't appear so it seems that this problem is fixed in upstream jdk 17 but not in other versions of jdk? |
@everything411 thanks for testing! If you don't mind one final question: is there an OpenJDK 11 build that you've seen that doesn't has this problem? Maybe Zulu, or Oracle JDK? |
Could you please check if this issue is still happening with the packages published at microsoft.com/openjdk ? |
the same result as before, ok for jdk17 and bad encoding for jdk11. i also notice that javac's help text still broken in both jdk11 and jdk17. these texts are GBK-encoded and then printed to the UTF-8 console, leading to these "�"
encoding of compiling error texts are bad, too, GBK-encoded text printed to UTF-8 console
and i also find that runtime exception texts encoding for jdk11 is ok but for jdk17 it is bad for jdk11 "系统找不到指定的文件" means "No such file or directory" in english
for jdk17, "绯荤粺鎵句笉鍒版寚瀹氱殑鏂囦欢銆�" is meaningless, and it seems that "绯荤粺鎵句笉鍒版寚瀹氱殑鏂囦欢銆�" is the text "系统找不到指定的文件" encoded in UTF-8 is decoded as GBK, and then the GBK-decoded text is encoded in UTF-8 and printed to the UTF-8 console
|
output of
output of
|
i tried Temurin JDK 18 and java and javac is ok.
However, runtime exception texts are still bad, the same problem as jdk17
output of java.exe -XshowSettings:properties -version for jdk18
|
Digression: Why do you want to enable this beta utf-8 option? |
@imba-tjd linux and macos both set the default encoding to utf8. i need to share source codes with chinese characters between my windows machine and linux machine (wsl1 and wsl2 use utf-8, too). |
Did you tried to input Chinese from stdin? Try this System.out.println(new Scanner(System.in).nextLine()); You will find that it fails to read, if you enabled the beta utf8. |
I have also noticed this bug before. infact it not only affects java, but for C scanf, C++ cin, C# Console.Readline, they all don't accept chinese when utf8 enabled. I believe that this is a windows console related bug instead of the language runtime. |
The issue https://bugs.openjdk.org/browse/JDK-8272352 might be relevant here; it was backported to OpenJDK 11.0.17 and Java 17.0.5 quite recently. (Just passing by... I saw this thread as I was fixing Unicode problems in the NetBeans IDE.) |
@everything411 Are you able to try with our latest 17.0.5 build? As @eirikbakke mentions, the upstream issue seems to be fixed. |
@karianna I can confirm that all bugs I reported here no longer exist now. |
Describe the bug
I'm using the Chinese Simplified version of Windows 10 with "Beta: Use Unicode UTF-8 for worldwide language support" enabled. Help text in java is still encoded with GBK, so it cannot be displayed correctly. Other texts shown by java.exe are also affected. I don't know if this happens for other languages or not.
I also tryed AdoptOpenJDK, and it also have this problem. So maybe this is an upstream bug? Where should i report this?
Thanks
Steps to reproduce the behavior:
Expected behavior
Help text is shown correctly.
Screenshots
![screenshot](https://user-images.githubusercontent.com/32010059/118390506-0ad95e80-b662-11eb-8241-89d917d05238.png)
output of
java --help
, help text encoded with GBK while the system is using UTF-8java-help.txt
The text was updated successfully, but these errors were encountered: