RFR: 8276970: Default charset for PrintWriter that wraps PrintStream

Alan Bateman alanb at openjdk.java.net
Tue Nov 16 12:24:34 UTC 2021


On Mon, 15 Nov 2021 22:43:37 GMT, Naoto Sato <naoto at openjdk.org> wrote:

> Fixing the default charset for PrintWriter/OutputStreamWriter that wraps a PrintStream to its charset. This issue was raised during the conversations in https://github.com/openjdk/jdk/pull/5771
> A corresponding CSR has also been drafted: https://bugs.openjdk.java.net/browse/JDK-8277078

src/java.base/share/classes/java/io/PrintWriter.java line 139:

> 137:      * the charset in {@code out} if it is a {@code PrintStream}, or using
> 138:      * the default charset.
> 139:      *

I think I prefer the wording in OutputStreamWriter because it puts the default encoding first and makes it just a bit clearer that the PS case is the exception.

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

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


More information about the core-libs-dev mailing list