Skip to content

Commit 031c033

Browse files
committed
8275145: file.encoding system property has an incorrect value on Windows
Reviewed-by: iris
1 parent 90273f3 commit 031c033

File tree

1 file changed

+9
-1
lines changed
  • src/java.base/share/native/libjava

1 file changed

+9
-1
lines changed

src/java.base/share/native/libjava/System.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -146,7 +146,15 @@ Java_jdk_internal_util_SystemProps_00024Raw_platformProperties(JNIEnv *env, jcla
146146
PUTPROP(propArray, _path_separator_NDX, sprops->path_separator);
147147
PUTPROP(propArray, _line_separator_NDX, sprops->line_separator);
148148

149+
#ifdef MACOSX
150+
/*
151+
* Since sun_jnu_encoding is now hard-coded to UTF-8 on Mac, we don't
152+
* want to use it to overwrite file.encoding
153+
*/
149154
PUTPROP(propArray, _file_encoding_NDX, sprops->encoding);
155+
#else
156+
PUTPROP(propArray, _file_encoding_NDX, sprops->sun_jnu_encoding);
157+
#endif
150158
PUTPROP(propArray, _sun_jnu_encoding_NDX, sprops->sun_jnu_encoding);
151159

152160
/*

0 commit comments

Comments
 (0)