RFR: 8353698: Output of Simple Web Server is garbled if the console's encoding is not UTF-8 [v3]

Daishi Tabata duke at openjdk.org
Fri Apr 4 11:20:55 UTC 2025


On Fri, 4 Apr 2025 10:36:51 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Daishi Tabata has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update full name
>
> Hi, it's not completely clear to me why `static final String LOCALE_OPT = "-Duser.language=en -Duser.country=US";` has now to be passed to every test that checks command line options. Is that a separate unrelated test fix?

@dfuch Thank you for your comment.
> Is that a separate unrelated test fix?

No, it's related.

For example, after this modification, if you run `jwebserver --help` on Japanese Windows without specifying a locale, it will be output in Japanese as follows:


> jwebserver.exe --help
使用方法: jwebserver [-b bind address] [-p port] [-d directory]
                  [-o none|info|verbose] [-h to show options]
                  [-version to show version information]
オプション:
-b, --bind-address    - バインド先アドレス。デフォルト: 127.0.0.1 (ループバック)。
                        すべてのインタフェースで"-b 0.0.0.0"または"-b ::"を使用します。
-d, --directory       - 使用するディレクトリ。デフォルト: 現在のディレクトリ。
-o, --output          - 出力形式。none|info|verbose。デフォルト: info。
-p, --port            - リスニングするポート。デフォルト: 8000。
-h, -?, --help        - ヘルプ・メッセージを出力して終了します。
-version, --version   - バージョン情報を出力して終了します。
サーバーを停止するには、[Ctrl]+[C]を押します。


This is the same in jtreg tests, so if you test it on Japanese Windows, it will fail.
By specifying the English locale to `jwebserver` or `java -m jdk.httpserver`, you can get English output even on Japanese Windows, so the test will be Passed.

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

PR Comment: https://git.openjdk.org/jdk/pull/24437#issuecomment-2778391933


More information about the net-dev mailing list