RFR: 8300819: -Dfile.encoding=Cp943C option does not work as expected since jdk18 [v2]

Ichiroh Takiguchi itakiguchi at openjdk.org
Sun Jan 22 23:45:01 UTC 2023


On Sun, 22 Jan 2023 23:17:10 GMT, Ichiroh Takiguchi <itakiguchi at openjdk.org> wrote:

>> 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
>
> Ichiroh Takiguchi has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8300819: -Dfile.encoding=Cp943C option does not work as expected since jdk18

First, Sorry I forgot to change Copyright date.

@AlanBateman , I appreciate your reply.
In my understanding,

- io stream side can use native.encoding system property.
- Now file.encoding system property is used for non-io stream.

This issue is related #11908 .
I need a solution to use the Cp943C charset as default charset.
Please give me some suggestion.

-------------

PR: https://git.openjdk.org/jdk/pull/12132


More information about the core-libs-dev mailing list