Details
-
Bug
-
Resolution: Fixed
-
P3
-
18, 19
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8287953 | 18u-cpu | Ichiroh Takiguchi | P3 | Resolved | Fixed | master |
JDK-8287608 | 18.0.2 | Ichiroh Takiguchi | P3 | Resolved | Fixed | b09 |
Description
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.
Please check following output.
================================
$ locale
LANG=ja_JP.eucjp
LC_CTYPE="ja_JP.eucjp"
LC_NUMERIC="ja_JP.eucjp"
LC_TIME="ja_JP.eucjp"
LC_COLLATE="ja_JP.eucjp"
LC_MONETARY="ja_JP.eucjp"
LC_MESSAGES="ja_JP.eucjp"
LC_PAPER="ja_JP.eucjp"
LC_NAME="ja_JP.eucjp"
LC_ADDRESS="ja_JP.eucjp"
LC_TELEPHONE="ja_JP.eucjp"
LC_MEASUREMENT="ja_JP.eucjp"
LC_IDENTIFICATION="ja_JP.eucjp"
LC_ALL=
$ cat Env.java
public class Env {
public static void main(String[] args) throws Exception {
for (String s : args)
System.out.println(s+"="+System.getenv(s));
}
}
$ export DATE=`date`
$ echo $DATE
2022年 4月 23日 土曜日 22:33:29 JST
$ ~/jdk-17.0.2/bin/java -showversion Env.java DATE
openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
DATE=2022年 4月 23日 土曜日 22:33:29 JST
$ ~/jdk-19+b19/bin/java -showversion Env.java DATE
openjdk version "19-ea" 2022-09-20
OpenJDK Runtime Environment (build 19-ea+19-1283)
OpenJDK 64-Bit Server VM (build 19-ea+19-1283, mixed mode, sharing)
DATE=2022? 4?? 23?? ?????? 22:33:29 JST
================================
When I wrote jtreg testcase, I found ProcessBuilder had same kind of issue.
System.getenv() returns unexpected value if environment variable has Japanese EUC characters.
It seems this issue happens because of JEP 400.
Please check following output.
================================
$ locale
LANG=ja_JP.eucjp
LC_CTYPE="ja_JP.eucjp"
LC_NUMERIC="ja_JP.eucjp"
LC_TIME="ja_JP.eucjp"
LC_COLLATE="ja_JP.eucjp"
LC_MONETARY="ja_JP.eucjp"
LC_MESSAGES="ja_JP.eucjp"
LC_PAPER="ja_JP.eucjp"
LC_NAME="ja_JP.eucjp"
LC_ADDRESS="ja_JP.eucjp"
LC_TELEPHONE="ja_JP.eucjp"
LC_MEASUREMENT="ja_JP.eucjp"
LC_IDENTIFICATION="ja_JP.eucjp"
LC_ALL=
$ cat Env.java
public class Env {
public static void main(String[] args) throws Exception {
for (String s : args)
System.out.println(s+"="+System.getenv(s));
}
}
$ export DATE=`date`
$ echo $DATE
2022年 4月 23日 土曜日 22:33:29 JST
$ ~/jdk-17.0.2/bin/java -showversion Env.java DATE
openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
DATE=2022年 4月 23日 土曜日 22:33:29 JST
$ ~/jdk-19+b19/bin/java -showversion Env.java DATE
openjdk version "19-ea" 2022-09-20
OpenJDK Runtime Environment (build 19-ea+19-1283)
OpenJDK 64-Bit Server VM (build 19-ea+19-1283, mixed mode, sharing)
DATE=2022? 4?? 23?? ?????? 22:33:29 JST
================================
When I wrote jtreg testcase, I found ProcessBuilder had same kind of issue.
Attachments
Issue Links
- backported by
-
JDK-8287608 System.getenv() returns unexpected value if environment variable has non ASCII character
- Resolved
-
JDK-8287953 System.getenv() returns unexpected value if environment variable has non ASCII character
- Resolved
- relates to
-
JDK-8166606 System.getenv() returns corrupted/incorrectly encoded strings when JVM is UTF-16/BE/LE
- Open
- links to
-
Commit openjdk/jdk18u/751cadc1
-
Commit openjdk/jdk/890771e7
-
Review openjdk/jdk18u/139
-
Review openjdk/jdk/8378
(2 links to)