8278908: [macOS] Unexpected text normalization on pasting from clipboard

Reviewed-by: serb, aivanov
This commit is contained in:
Dmitry Batrak 2022-01-31 13:43:35 +00:00
parent 61794c5039
commit 091aff92e2
2 changed files with 2 additions and 11 deletions
src/java.desktop/macosx/classes/sun/lwawt/macosx
test/jdk/java/awt/datatransfer/UnicodeTransferTest

@ -33,8 +33,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.Charset;
import java.text.Normalizer;
import java.text.Normalizer.Form;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@ -165,9 +163,6 @@ public class CDataTransferer extends DataTransferer {
// regular string that allows to translate data to target represantation
// class by base method
format = CF_STRING;
} else if (format == CF_STRING) {
String src = new String(bytes, UTF_8);
bytes = Normalizer.normalize(src, Form.NFC).getBytes(UTF_8);
}
return super.translateBytes(bytes, flavor, format, transferable);

@ -25,7 +25,7 @@
/*
@test
@key headful
@bug 4718897
@bug 4718897 8278908
@summary tests that a Unicode string can be transferred between JVMs.
@author das@sparc.spb.su area=datatransfer
@library ../../regtesthelpers/process
@ -35,7 +35,6 @@
import java.awt.datatransfer.*;
import java.awt.*;
import java.text.Normalizer;
import test.java.awt.regtesthelpers.process.ProcessResults;
import test.java.awt.regtesthelpers.process.ProcessCommunicator;
@ -77,10 +76,7 @@ class Util {
buf.append(0x20);
}
}
// On OS X the unicode string is normalized but the clipboard,
// so we need to use normalized strings as well to be able to
// check the result
testString = Normalizer.normalize(buf.toString(), Normalizer.Form.NFC);
testString = buf.toString();
}
public static String getTestString() {