mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8209576: java.nio.file.Files.writeString writes garbled UTF-16 instead of UTF-8
Reviewed-by: sherman
This commit is contained in:
parent
0f4805ef4c
commit
0afc1b41c3
2 changed files with 86 additions and 14 deletions
|
@ -1068,7 +1068,7 @@ class StringCoding {
|
|||
byte[] val = s.value();
|
||||
byte coder = s.coder();
|
||||
if (cs == UTF_8) {
|
||||
if (isASCII(val)) {
|
||||
if (coder == LATIN1 && isASCII(val)) {
|
||||
return val;
|
||||
}
|
||||
return encodeUTF8(coder, val, false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue