RFR: 8285517: System.getenv() returns unexpected value if environment variable has non ASCII character [v6]

Ichiroh Takiguchi itakiguchi at openjdk.java.net
Sun May 8 16:16:51 UTC 2022


On Sat, 7 May 2022 06:50:40 GMT, Ichiroh Takiguchi <itakiguchi at openjdk.org> wrote:

>> On JDK19 with Linux ja_JP.eucjp locale,
>> System.getenv() returns unexpected value if environment variable has Japanese EUC characters.
>> It seems this issue happens because of JEP 400.
>> Arguments for ProcessBuilder have same kind of issue.
>
> Ichiroh Takiguchi has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8285517: System.getenv() returns unexpected value if environment variable has non ASCII character

I checked internal data

$ cat StaticPropertyVals.java 
import java.lang.reflect.*;

public class StaticPropertyVals {
  public static void main(String[] args) throws Exception {
    Class<?> cls = Class.forName("jdk.internal.util.StaticProperty");
    for (Field fid : cls.getDeclaredFields()) {
      if (Modifier.isStatic(fid.getModifiers())) {
        fid.setAccessible(true);
        System.out.println(fid.getName() + "=" + fid.get(null));
      }
    }
  }
}
$ env LANG=kk_KZ.pt154 LC_ALL=kk_KZ.pt154 java -XshowSettings:properties --add-opens=java.base/jdk.internal.util=ALL-UNNAMED StaticPropertyVals 2>&1 | egrep -i 'encoding|charset'
WARNING: The encoding of the underlying platform's file system is not supported: PT154
    file.encoding = UTF-8
    native.encoding = PT154
    sun.io.unicode.encoding = UnicodeLittle
    sun.jnu.encoding = UTF-8
NATIVE_ENCODING=PT154
FILE_ENCODING=UTF-8
SUN_JNU_ENCODING=UTF-8
jnuCharset=UTF-8
$

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

PR: https://git.openjdk.java.net/jdk/pull/8378


More information about the core-libs-dev mailing list