<i18n dev> RFR: 8274544: Langtools command's usage were garbled on Japanese Windows [v4]

Ichiroh Takiguchi itakiguchi at openjdk.java.net
Mon Oct 25 16:04:13 UTC 2021


On Mon, 25 Oct 2021 14:20:52 GMT, Ichiroh Takiguchi <itakiguchi at openjdk.org> wrote:

>> JEP-400 (UTF-8 by Default) was eabled on JDK18-b13.
>> After JDK18-b13, javac and some other langtool command's usage were garbled on Japanese Windows.
>> These commands use PrintWriter instead of standard out/err with PrintStream.
>
> Ichiroh Takiguchi has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
> 
>  - 8274544: Langtools command's usage were garbled on Japanese Windows
>  - 8274544: Langtools command's usage were garbled on Japanese Windows
>  - 8274544: Langtools command's usage were garbled on Japanese Windows
>  - Langtools command's usage were grabled on Japanese Windows

Terminal setting

$ locale
LANG=ja_JP.eucjp
LC_CTYPE="ja_JP.eucjp"
LC_NUMERIC="ja_JP.eucjp"
LC_TIME="ja_JP.eucjp"
LC_COLLATE="ja_JP.eucjp"
LC_MONETARY="ja_JP.eucjp"
LC_MESSAGES="ja_JP.eucjp"
LC_PAPER="ja_JP.eucjp"
LC_NAME="ja_JP.eucjp"
LC_ADDRESS="ja_JP.eucjp"
LC_TELEPHONE="ja_JP.eucjp"
LC_MEASUREMENT="ja_JP.eucjp"
LC_IDENTIFICATION="ja_JP.eucjp"
LC_ALL=

Java testcase by using Scanner.

$ cat scan.java 
import java.util.*;

public class scan {
  public static void main(String[] args) throws Exception {
    System.out.println("Please input some characters:");
    Scanner scanner = new Scanner(System.in);
    System.out.println(scanner.next());
  }
}
$ ~/jdk-18-b19/bin/java scan.java
Please input some characters:
あいうえお
??????????

When `src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractTerminal.java` is modified

$ jshell
|  JShellへようこそ -- バージョン18-internal
|  概要については、次を入力してください: /help intro

jshell> import java.nio.charset.*

jshell> System.out.println(System.getProperty("native.encoding"))
EUC-JP-LINUX

jshell> System.out.println(Charset.defaultCharset())
UTF-8

jshell> var scan = new Scanner(System.in)
scan ==> java.util.Scanner[delimiters=\p{javaWhitespace}+] ... \E][infinity string=\Q∞\E]

jshell> var s = scan.next()
あいうえお
s ==> "あいうえお"

jshell> System.out.println(s)
あいうえお

jshell> /exit
|  終了します
$

-------------

PR: https://git.openjdk.java.net/jdk/pull/5771


More information about the i18n-dev mailing list