Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6203463

Carret position with supplementary characters is inconsistent between Solaris and RedHat

    XMLWordPrintable

Details

    Description

      The test attached to the end of this note contains a string with properly paired surrogates. When you type the following keys, CaretEvent getDot() returns a different value on Solaris than is does on RedHat AS3 on the last key:
       
      (Type the following keys in this order)
         1) HOME
         2) DOWN ARROW
         3) END
         4) LEFT ARROW
         5) LEFT ARROW
         6) LEFT ARROW
         7) UP ARROW
         
      I've tested this using 1.5.0(b32c, b32d, b64) and 1.6.0(b13). The carret position on the UP ARROW is always 2 on Solaris and 3 on RedHat.

      ----------------------------------------------
      import javax.swing.*;
      import javax.swing.event.*;

      public class SupplementaryTest extends JFrame {

          private JTextArea textArea;
          private JPanel panel;

          public static void main(String[] args) {
      String text = "\uD801\uDC00\uD800\uD802\uDBFF\uDFFE\n\uD800\uD801\uDC00\uDBFF\uDFFF\uDFFE";
              new SupplementaryTest(text);
          }

          public SupplementaryTest(String text) {

              textArea = new JTextArea(text);
              textArea.addCaretListener(new CaretListener() {
                  public void caretUpdate(CaretEvent e) {
                      System.out.println("Carret position: " + e.getDot());
                  }
              });

              panel = new JPanel();
              panel.add(textArea);
              setContentPane(panel);
              setSize(200, 200);
              show();
          }
      ----------------------------------------------

      Attachments

        Activity

          People

            yyamasaksunw Yuriko Yamasaki (Inactive)
            sjchan Steven Chan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: