<i18n dev> RFR: 8274544: Langtools command's usage were garbled on Japanese Windows [v5]
Ichiroh Takiguchi
itakiguchi at openjdk.java.net
Mon Nov 22 16:16:26 UTC 2021
On Fri, 19 Nov 2021 16:48:03 GMT, Naoto Sato <naoto at openjdk.org> wrote:
>> Hello @naotoj .
>> For PrintStream.getCharset(), following changes may be required.
>>
>> +++ src/java.base/share/classes/java/io/OutputStreamWriter.java
>> + Charset getCharset() {
>> + return se.getCharset();
>> + }
>>
>> +++ src/java.base/share/classes/java/io/PrintStream.java
>> + public Charset getCharset() {
>> + return charOut.getCharset();
>> + }
>>
>> +++ src/java.base/share/classes/sun/nio/cs/StreamEncoder.java
>> + public Charset getCharset() {
>> + return cs;
>> + }
>>
>> For javac code, we may not use PrintStream.getCharset() directly because javac code is compiled by boot compiler.
>> We need to use reflection, like:
>>
>> +++ src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java
>> + private static Charset getCharset(PrintStream ps) {
>> + try {
>> + Method getCharset = PrintStream.class.getDeclaredMethod("getCharset");
>> + return (Charset)getCharset.invoke(ps);
>> + } catch (Exception e) {
>> + return Charset.defaultCharset();
>> + }
>> + }
>>
>> If we add following constructors against PrintWriter, we just change javap and jshell code.
>> But I cannot evaluate this code changes.
>>
>> +++ src/java.base/share/classes/java/io/PrintWriter.java
>> + public PrintWriter(PrintStream ps) {
>> + this((OutputStream)ps, false, ps.getCharset());
>> + }
>> + public PrintWriter(PrintStream ps, boolean autoFlush) {
>> + this((OutputStream)ps, autoFlush, ps.getCharset());
>> + }
>>
>> I really appreciate if you handle this kind of code change via JEP-400.
>
> I think this PR can now safely be withdrawn, as https://github.com/openjdk/jdk/pull/6401 is now integrated. @takiguc, if you do not mind, I will create a PR for the remaining jshell issue. Please let me know.
Thanks @naotoj .
I opened new pr via 8274784.
I'd like to close this pr since main issue was fixed by #6401.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5771
More information about the i18n-dev
mailing list