JDK-8123556 : Surrogate pair characters are rendered incorrectly or not rendered on WebView
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 7u40
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-09-27
  • Updated: 2015-06-17
  • Resolved: 2013-09-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8Fixed
Related Reports
Relates :  
Description
Surrogate pair characters are rendered incorrectly or not rendered on the following program.
Note: A font file mingliub.ttf (Windows font file) must be installed on the OS (Windows, MacOSX).

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

public class Main extends Application {
    public final static void main(String[] arguments) {
        Application.launch(arguments);
    }
    @Override
    public void start(Stage stage) throws Exception {
        WebView webView = new WebView();
        webView.getEngine().loadContent("<!DOCTYPE html>\n<html><head></head><body><p style=\"font-family:PMingLiU-ExtB;font-size:200%;text-decoration:underline;\">&#x20000;</p></body></html>");
        webView.setPrefSize(800, 600);
        Scene scene = new Scene(webView);
        stage.setScene(scene);
        stage.sizeToScene();
        stage.show();
    }
}

The text part "&#x20000;" is for a character "������" in CJK Unified Ideographs Extension B.
In the case of "&#x20000;" ... any are not rendered.
In the case of "������" ... six "?" characters with underline are rendered.
In the case of "&#xD840;&#xDC00;" ... two "?" characters with underline are rendered.
In the case of "a&#x20000;" ... "a" and "������" are rendered. "a" is with underline, but "������" is not with underline. And "a" is selectable, but "������" is not selectable.
In the case of "&#x20000;a" ... "������" and "a" are rendered. The left half of "������" is with underline, and the rest is not with underline, and "a" is not with underline The underline part is selectable and "a" appears on the selecting.
In the case of "&#x20000;aa" ... "������" and "aa" are rendered. "������" is with underline, "aa" is not with underline. "������" is selectable, but "aa" appears on the selecting.

Note: On using HTMLEditor instead of WebView, the same characters and underlines are displayed.  The cursor moving (and displaying) is incorrectly. But Ctrl+C is valid, and I can copy the character "������" and paste into the clipboard.

Note2: On Java 8 Build b108 (on MacOSX), these problems seem to be not appeared.   On Java 7, will they be fixed?
Comments
Surrogate pairs were fixed as part of RT-24772. This fix will not be backported as it depends on glyph lists that were introduced in JDK8.
30-09-2013