RFR: 8260265: UTF-8 by Default

Jesse Glick github.com+154109+jglick at openjdk.java.net
Wed Jul 14 16:23:13 UTC 2021


On Wed, 14 Jul 2021 15:09:41 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> This is an implementation for the `JEP 400: UTF-8 by Default`. The gist of the changes is `Charset.defaultCharset()` returning `UTF-8` and `file.encoding` system property being added in the spec, but another notable modification is in `java.io.PrintStream` where it continues to use the `Console` encoding as the default charset instead of `UTF-8`. Other changes are mostly clarification of the term "default charset" and their links. Corresponding CSR has also been drafted.
>> 
>> JEP 400: https://bugs.openjdk.java.net/browse/JDK-8187041
>> CSR: https://bugs.openjdk.java.net/browse/JDK-8260266
>
> 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.

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

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


More information about the core-libs-dev mailing list