RFR: 8265989: System property for the native character encoding name
alanb at openjdk.java.net
Thu Apr 29 13:26:49 UTC 2021
On Thu, 29 Apr 2021 13:11:53 GMT, Naoto Sato <naoto at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/util/SystemProps.java line 69:
>>> 67: ? raw.propDefault(Raw._sun_jnu_encoding_NDX)
>>> 68: : raw.propDefault(Raw._file_encoding_NDX));
>>> 69: put(props, "native.encoding", nativeEncoding);
>> Shouldn't native.encoding be biased toward sun.jnu.encoding rather than file.encoding? Or maybe you'll change it when preparing the changes for JEP 400?
> `native.encoding` preserves the encoding that current `Charset.defaultCharset()` is returning, which is based on `file.encoding`. So I believe the current implementation is correct. If it is biased toward `sun.jnu.encoding`, it would be problematic especially on Windows where that represents `system locale`.
Okay for now but the value of file.encoding will change to "UTF-8" so will be different to native.encoding.
More information about the core-libs-dev