RFR: 8283620: System.out does not use the encoding/charset specified in the Javadoc
Alan Bateman
alanb at openjdk.java.net
Fri Apr 22 09:34:25 UTC 2022
On Fri, 15 Apr 2022 20:26:55 GMT, Naoto Sato <naoto at openjdk.org> wrote:
> Promoting the internal system properties for `System.out` and `System.err` so that users can override the encoding used for those streams to `UTF-8`, aligning to the `Charset.defaultCharset()`. A CSR has also been drafted.
src/java.base/share/classes/java/lang/System.java line 780:
> 778: * The property may be set on the command line to the value
> 779: * {@code UTF-8}. Setting the property to a value other than {@code UTF-8}
> 780: * leads to unspecified behavior.
I think the proposal to introduce two standard properties is good and is consistent with the recently introduced native.encoding. I'm not 100% sure that the sentence "The property may be set on the command line ..." is appropriate for the spec of standard properties. We got away with that for file.encoding in implNote but that isn't spec. I think we may have to replace this with something that says that the Java runtime can be started with the system property set to "UTF-8", starting it with the property set to another value clears to undefined behavior.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8270
More information about the core-libs-dev
mailing list