RFR: 8260265: UTF-8 by Default [v2]

Naoto Sato naoto at openjdk.java.net
Wed Jul 14 21:02:07 UTC 2021


On Wed, 14 Jul 2021 16:20:28 GMT, Jesse Glick <github.com+154109+jglick at openjdk.org> wrote:

>> src/java.base/share/classes/java/io/PrintStream.java line 49:
>> 
>>> 47:  * <p> All characters printed by a {@code PrintStream} are converted into
>>> 48:  * bytes using the given encoding or charset, or the default
>>> 49:  * console charset if not specified.
>> 
>> JEP 400 doesn't give a rationale for using the console charset for PrintStream.
>> PrintStreams are used for output to files and other media other than just a tty/console.
>> The charset of system.out/err should use the console charset.
>
> This was my thinking in https://github.com/openjdk/jdk/pull/4733#issuecomment-876793372.

OK, I am now conviced. Modified not to default to Console.charset() for generic PrintStream w/o charset constructor.

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

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


More information about the core-libs-dev mailing list