Re: RFR: 8260265: UTF-8 by Default

2021-07-14 Thread Jesse Glick
On Wed, 14 Jul 2021 15:09:41 GMT, Roger Riggs  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:  *  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


Re: RFR: 8260265: UTF-8 by Default

2021-07-12 Thread Jesse Glick
On Thu, 8 Jul 2021 21:23:00 GMT, Naoto Sato  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

I would have expected `System.out` and `.err` to use the console encoding, but 
application-constructed `PrintStream`s to use UTF-8 by default.

-

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