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

System property for the native character encoding name

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 17
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      This is a new system property. No compatibility risk is anticipated.
    • Interface Kind:
      Java API, System or security property
    • Scope:
      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 JEP400, 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

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

                Dates

                Created:
                Updated:
                Resolved: