RFR: 8285517: System.getenv() returns unexpected value if environment variable has non ASCII character [v5]
Naoto Sato
naoto at openjdk.java.net
Fri May 6 20:08:05 UTC 2022
On Fri, 6 May 2022 14:23:00 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
src/java.base/share/classes/jdk/internal/util/StaticProperty.java line 77:
> 75: SUN_JNU_ENCODING = getProperty(props, "sun.jnu.encoding");
> 76: jnuCharset = Charset.forName(SUN_JNU_ENCODING, Charset.defaultCharset());
> 77: }
I am not sure it is OK to initialize `Charset` here, as `sun_jnu_encoding` is initialized in `System.initPhase1()` and pulling `Charset` there may cause some init order change. I'd only cache the encoding string here.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8378
More information about the core-libs-dev
mailing list