New candidate JEP: 400: UTF-8 by Default
ecki at zusammenkunft.net
Thu Mar 11 01:12:49 UTC 2021
I like it. The only thing which I feel is missing would be an official API to get the operating environments default encoding (essentially to get the value used if COMPAT would have been specified).
For example, in our server application, we do have some code which is specified as using exactly this charset (I.e. if user configures targetEncoding=PLATFORM we are using intentionally the no-arg APIs). We can change that code to specify a Charset, but then we need a way to retrieve that - without poking into unsupported system properties or environment properties. For example System.platformCharset().
I understand that this might have it’s own complications - as not all OS have this concept (for example on Windows there might be different codepages depending on the unicode status of an application). But falling back to today’s file.encoding code would at least be consistent and the behavior most implementer would desire when adapting legacy code to this JEP.
Von: core-libs-dev <core-libs-dev-retn at openjdk.java.net> im Auftrag von mark.reinhold at oracle.com <mark.reinhold at oracle.com>
Gesendet: Thursday, March 11, 2021 1:27:05 AM
An: naoto.sato at oracle.com <naoto.sato at oracle.com>
Cc: core-libs-dev at openjdk.java.net <core-libs-dev at openjdk.java.net>; jdk-dev at openjdk.java.net <jdk-dev at openjdk.java.net>
Betreff: New candidate JEP: 400: UTF-8 by Default
Summary: Use UTF-8 as the JDK's default charset, so that APIs that
depend on the default charset behave consistently across all platforms
and independently of the userâ€™s locale and configuration.
More information about the jdk-dev