RFR: 8353698: Output of Simple Web Server is garbled if the console's encoding is not UTF-8 [v2]
Tabata Daishi
duke at openjdk.org
Fri Apr 4 06:47:02 UTC 2025
> The output `jwebserver` and `java -m jdk.httpserver` uses UTF-8 encoding. Therefore, if the console encoding is not set to UTF-8 (for example, MS932 on Japanese Windows), garbled characters may appear.
> Since System.out knows the console's encoding, there's no need to specify it again with PrintWriter constructor.
>
> The output `jwebserver` and `java -m jdk.httpserver` is localized in Japanese, German, and Chinese. This bug only occurs in these localized languages, so I haven't added any tests.
> I have confirmed that the output of the two commands is not garbled in the default command prompts of both Japanese Windows and English Windows.
>
> I tested jdk/com/sun/net/httpserver/simpleserver on English Windows, and all tests passed. However, when running on Japanese Windows, some tests failed because they expected output only in English.
> I modified the tests so that `jwebserver` and `java -m jdk.httpserver` within the tests are executed with an English locale. After this modification, all tests passed on Japanese Windows.
Tabata Daishi has updated the pull request incrementally with one additional commit since the last revision:
run jcheck
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/24437/files
- new: https://git.openjdk.org/jdk/pull/24437/files/7e149b6f..427cbe4b
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=24437&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=24437&range=00-01
Stats: 0 lines in 0 files changed: 0 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/24437.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24437/head:pull/24437
PR: https://git.openjdk.org/jdk/pull/24437
More information about the net-dev
mailing list