RFR: 8265989: System property for the native character encoding name
Joe Wang
joehw at openjdk.java.net
Thu Apr 29 00:44:51 UTC 2021
On Wed, 28 Apr 2021 22:24:31 GMT, Naoto Sato <naoto at openjdk.org> wrote:
> After some internal discussion, we thought it was good to expose the native environment's default character encoding, which Charset.defaultCharset() is currently based on. This way applications will have a better migration path after the [JEP 400](https://openjdk.java.net/jeps/400) is implemented, in which Charset.defaultCharset() will return UTF-8, but the value of this new system property will remain intact. A [CSR](https://bugs.openjdk.java.net/browse/JDK-8266075) has been filed with more detailed information.
src/java.base/share/classes/java/lang/System.java line 704:
> 702: * <tr><th scope="row">{@systemProperty native.encoding}</th>
> 703: * <td>Character encoding name derived from the host environment and/or
> 704: * the user's settings. Setting this system property has no effect.</td></tr>
May be "This property is read-only" instead of "Setting this system property has no effect" to not confuse with "user's settings"?
test/jdk/java/lang/System/PropertyTest.java line 83:
> 81: {"java.runtime.version"},
> 82: {"java.runtime.name"},
> 83: {"native.encoding"},
Does this test differentiate between read-only and modifiable properties? "native.encoding" looks like it's explicitly overridable. Or do we need a test to verify it's not overridable?
-------------
PR: https://git.openjdk.java.net/jdk/pull/3777
More information about the core-libs-dev
mailing list