Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8266075

System property for the native character encoding name

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 17
    • core-libs
    • None
    • minimal
    • This is a new system property. No compatibility risk is anticipated.
    • Java API, System or security property
    • SE

    Description

      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>

      Attachments

        Issue Links

          Activity

            People

              naoto Naoto Sato
              naoto Naoto Sato
              Alan Bateman, Iris Clark, Roger Riggs
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: