RFR: 8353698: Output of Simple Web Server is garbled if the console's encoding is not UTF-8 [v3]
Daniel Fuchs
dfuchs at openjdk.org
Mon Apr 7 09:27:55 UTC 2025
On Mon, 7 Apr 2025 06:11:30 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Daishi Tabata has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update full name
>
> src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/JWebServer.java line 66:
>
>> 64: setMaxConnectionsIfNotSet();
>> 65:
>> 66: int ec = SimpleFileServerImpl.start(new PrintWriter(System.out, true), "jwebserver", args);
>
> I think you are looking for stdout.encoding here.
Are you suggesting changing this line @AlanBateman? The API doc of `PrintWriter(OutputStream, boolean)` says:
* Creates a new PrintWriter from an existing OutputStream. This
* convenience constructor creates the necessary intermediate
* OutputStreamWriter, which will convert characters into bytes using
* the default charset, or where {@code out} is a {@code PrintStream},
* the charset used by the print stream.
Isn't this what we want here?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24437#discussion_r2030842093
More information about the net-dev
mailing list