RFR: 8274544: Langtools command's usage were garbled on Japanese Windows [v2]
Ichiroh Takiguchi
itakiguchi at openjdk.java.net
Wed Oct 6 15:58:07 UTC 2021
On Wed, 6 Oct 2021 00:02:55 GMT, Naoto Sato <naoto at openjdk.org> wrote:
>> Ichiroh Takiguchi has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8274544: Langtools command's usage were garbled on Japanese Windows
>
> I just grepped `System.out/err` in jshell source directory, and found another location in `tool/JShellToolProvider.java` that uses bare stdout/err. Would you also apply the fix and see the result?
Hello @naotoj .
Sorry I'm late.
> I just grepped `System.out/err` in jshell source directory, and found another location in `tool/JShellToolProvider.java` that uses bare stdout/err. Would you also apply the fix and see the result?
I applied following changes and lahodaj's code (I'm not sure, it's expected one...)
: in;
PrintStream xout =
(out == null)
- ? System.out
+ ? new PrintStream(System.out, true, nativeCharset)
: (out instanceof PrintStream)
? (PrintStream) out
- : new PrintStream(out);
+ : new PrintStream(out, true, nativeCharset);
PrintStream xerr =
(err == null)
- ? System.err
+ ? new PrintStream(System.err, true, nativeCharset)
: (err instanceof PrintStream)
? (PrintStream) err
- : new PrintStream(err);
+ : new PrintStream(err, true, nativeCharset);
try {
return JavaShellToolBuilder
.builder()
But it did not work for previously saved encoded command list.
(lahodaj's code worked fine for standard case.)
I think you may be confused because of my bad explanation.
User can create Jshell's command list by `/save`.
Native encoding was used before JDK18.
Now UTF-8 is used by JDK18.
To read saved command list (`/open`) which was encoded by native encoding, Charset.defaultCharset() should be same as native.encoding...
I think we need to provide workaround for it.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5771
More information about the core-libs-dev
mailing list