Summary
The system property native.encoding
provides the underlying host environment's character encoding name.
Problem
JEP 400 intends to switch the default Charset to UTF-8
. Once JEP 400 has been introduced, java.nio.charset.Charset#defaultCharset()
would always return UTF-8
as the Charset
used in 1-arg InputStreamReader
/OutputStreamWriter
constructors. Applications that relied on the method to return the encoding of the host environment will have no migration path without it.
Solution
To encourage apps for smooth migration, provide the character encoding name of the host environment with a new system property native.encoding
. The value of the system property will be equivalent to the existing file.encoding
value (becomes public with JEP 400, fixed to UTF-8
), however, setting the value of this new system property, either via the command line or with System.setProperty()
, will have no effect.
Specification
Append the following row in the chart listing the system properties in java.lang.System#getProperties()
method.
* <tr><th scope="row">{@systemProperty native.encoding}</th>
* <td>Character encoding name derived from the host environment and/or
* the user's settings. Setting this system property has no effect.</td></tr>
- csr of
-
JDK-8265989 System property for the native character encoding name
- Resolved