You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
openjdk version "19.0.2" 2023-01-17
OpenJDK Runtime Environment GraalVM CE 22.3.1 (build 19.0.2+7-jvmci-22.3-b12)
OpenJDK 64-Bit Server VM GraalVM CE 22.3.1 (build 19.0.2+7-jvmci-22.3-b12, mixed mode, sharing)
Describe the issue
When evalling java method in js script, the result string encoding error.(UTF-8)
I'm sure all files are UTF8 charset encoded.
I am sorry, I am not able to reproduce this issue. I see the expected output. Have you tried to set name and password properties of RegisterUserReq (and print the output of UserService.register()) using pure Java (i.e. without the usage of JavaScript)? Does it print the expected output or is it garbled as well? I am curious if the issue is really caused by GraalVM or whether it is some issue of the tool that you use to display the test results.
@iamstolis Oh, thank you for reminding me, I quickly checked the breakpoint and found that the code was indeed correct during execution, but the output was garbled.
Then I looked at all the encoding configurations of IDEA and found that they were all UTF-8. I tried to add -Dfile.encoding=UTF-8 and -Dconsole.encoding=UTF-8 VM options for IDEA, but it was useless at all, whether restart IDEA or restart the computer.
Just when I was frustrated, I thought about whether System.out had changed, and found that charset had indeed changed (it did not use the charset specified by -Dfile.encoding, but followed the default charset of the operating system) . I then changed the charset via the System.setOut method and it finally worked.
Finally, I continued to search and found that this is a bug of JDK19. The official provides a new -Dstdout.encoding=UTF-8 property to control the charset of System.out. See here.
Graal Version
Describe the issue
When evalling java method in js script, the result string encoding error.(UTF-8)
I'm sure all files are UTF8 charset encoded.
Code snippet
Expected behavior
Expected:
Actual:
The text was updated successfully, but these errors were encountered: