RFR: 8300819: -Dfile.encoding=Cp943C option does not work as expected since jdk18
Ichiroh Takiguchi
itakiguchi at openjdk.org
Sun Jan 22 15:34:37 UTC 2023
On jdk17, following testcase works fine on Linux platform.
Testcase
$ cat cstest1.java
import java.nio.charset.*;
public class cstest1 {
public static void main(String[] args) throws Exception {
Charset cs = Charset.defaultCharset();
System.out.println(cs + ", " + cs.getClass() + ", " + cs.getClass().getModule());
}
}
$ ~/jdk-17.0.6+10/bin/java -Dfile.encoding=Cp943C -showversion cstest1
openjdk version "17.0.6" 2023-01-17
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing)
x-IBM943C, class sun.nio.cs.ext.IBM943C, module jdk.charsets
But it does not work as expected on jdk18 and jdk21b06
$ ~/jdk-18.0.2.1+1/bin/java -Dfile.encoding=Cp943C -showversion cstest1
openjdk version "18.0.2.1" 2022-08-18
OpenJDK Runtime Environment Temurin-18.0.2.1+1 (build 18.0.2.1+1)
OpenJDK 64-Bit Server VM Temurin-18.0.2.1+1 (build 18.0.2.1+1, mixed mode, sharing)
UTF-8, class sun.nio.cs.UTF_8, module java.base
$ ~/jdk-21/bin/java -Dfile.encoding=Cp943C -showversion cstest1
openjdk version "21-ea" 2023-09-19
OpenJDK Runtime Environment (build 21-ea+6-365)
OpenJDK 64-Bit Server VM (build 21-ea+6-365, mixed mode, sharing)
UTF-8, class sun.nio.cs.UTF_8, module java.base
Fixed result is as follows:
$ java -Dfile.encoding=Cp943C -showversion PrintDefaultCharset
openjdk version "21-internal" 2023-09-19
OpenJDK Runtime Environment (build 21-internal-adhoc.jdktest.jdk)
OpenJDK 64-Bit Server VM (build 21-internal-adhoc.jdktest.jdk, mixed mode, sharing)
x-IBM943C
-------------
Commit messages:
- -Dfile.encoding=Cp943C option does not work as expected since jdk18
Changes: https://git.openjdk.org/jdk/pull/12132/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12132&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8300819
Stats: 45 lines in 2 files changed: 44 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/12132.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/12132/head:pull/12132
PR: https://git.openjdk.org/jdk/pull/12132
More information about the core-libs-dev
mailing list