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

[macosx] Chinese full stop symbol cannot be entered with Pinyin IM on OS X

    Details

    • Subcomponent:
    • Introduced In Build:
      b52
    • Introduced In Version:
      9
    • Resolved In Build:
      b94
    • OS:
      os_x

      Backports

        Description

        FULL PRODUCT VERSION :
        JDK 9, JDK 8u51, JDK 8u45-b31, JDK 8u40-b31, JDK 8u31-b33

        ADDITIONAL OS VERSION INFORMATION :
        OS X 10.10, OS X 10.9.5

        A DESCRIPTION OF THE PROBLEM :
        If "Pinyin – Traditional" or "Pinyin – Simplified" input method (IM) is selected and "dot" character is pressed on keyboard, then "." (U+002E - FULL STOP - Unicode code point) instead of "。" (U+3002 – IDEOGRAPHIC FULL STOP – Unicode code point) is inserted in JTextArea component on OS X.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1. Go to "System Preferences -> Keyboard -> Input Sources" and add "Pinyin – Traditional" or "Pinyin – Simplified" IM.
        2. Compile and run the test case attached as the file "Main.java".
        3. Set current IM to "Pinyin" added in the step #1, set focus to the text area of the test case dialog and press "dot" character on keyboard. Observe that "." is inserted instead of "。".
        1. Main.java
          0.6 kB
          Masayoshi Okutsu
        1. Screen_Shot_2015-07-28_at_14.47.41.png
          82 kB

          Issue Links

            Activity

            Hide
            alitvinov Anton Litvinov added a comment -
            The bug was reproduced by means of the attached test case "Main.java" on OS X 10.9.5 with JDK 9 b80, JDK 8u51 b16, JDK 8u31 b33. The bug could not be reproduced on the same host with JDK 8u31 b32, JDK 8u31 b13.

            This bug is a regression of the fix for JDK-8068283, which was introduced in JDK 8u31 b33. It was practically proven that reversion of the fix JDK-8068283 resolves the bug in JDK 8.
            Show
            alitvinov Anton Litvinov added a comment - The bug was reproduced by means of the attached test case "Main.java" on OS X 10.9.5 with JDK 9 b80, JDK 8u51 b16, JDK 8u31 b33. The bug could not be reproduced on the same host with JDK 8u31 b32, JDK 8u31 b13. This bug is a regression of the fix for JDK-8068283 , which was introduced in JDK 8u31 b33. It was practically proven that reversion of the fix JDK-8068283 resolves the bug in JDK 8.
            Hide
            alitvinov Anton Litvinov added a comment -
            FULL STOP character is entered in "javax.swing.JTextArea" component instead of the required IDEOGRAPHIC FULL STOP character, when "dot" character is pressed on the keyboard and Pinyin – Traditional or Simplified IM is enabled, because "java.awt.event.KeyEvent" is generated instead of "java.awt.event.InputMethodEvent".

            The fix for JDK-8068283 changed the condition which controls JNI invocation of "sun.lwawt.macosx.CInputMethod.insertText(String)" method generating "InputMethodEvent" in the file "jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m".

            From:
            "if ([self hasMarkedText] || !fProcessingKeystroke || (utf8Length > 1)) {"

            To:
            "if ([self hasMarkedText] || !fProcessingKeystroke || (utf16Length > 2)) {"

            In UTF-16 "。" character is encoded by one 16-bit code unit with hex value "3002", while in UTF-8 it is encoded by three 8-bit code units with hex values "E3 80 82". Therefore "(utf16Length > 2)" part of the condition shown above is not fulfilled for this character and "InputMethodEvent" is not generated.

            THE POSSIBLE SOLUTION:
            As the possible solution the specified above "if" condition from the file "AWTView.m" can be changed to additionally check whether the analyzed code point belongs to "CJK Symbols and Punctuation" code points range (U+3000 – U+303F) containing "。" character and, if it is so, to generate "InputMethodEvent".
            Show
            alitvinov Anton Litvinov added a comment - FULL STOP character is entered in "javax.swing.JTextArea" component instead of the required IDEOGRAPHIC FULL STOP character, when "dot" character is pressed on the keyboard and Pinyin – Traditional or Simplified IM is enabled, because "java.awt.event.KeyEvent" is generated instead of "java.awt.event.InputMethodEvent". The fix for JDK-8068283 changed the condition which controls JNI invocation of "sun.lwawt.macosx.CInputMethod.insertText(String)" method generating "InputMethodEvent" in the file "jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m". From: "if ([self hasMarkedText] || !fProcessingKeystroke || (utf8Length > 1)) {" To: "if ([self hasMarkedText] || !fProcessingKeystroke || (utf16Length > 2)) {" In UTF-16 "。" character is encoded by one 16-bit code unit with hex value "3002", while in UTF-8 it is encoded by three 8-bit code units with hex values "E3 80 82". Therefore "(utf16Length > 2)" part of the condition shown above is not fulfilled for this character and "InputMethodEvent" is not generated. THE POSSIBLE SOLUTION: As the possible solution the specified above "if" condition from the file "AWTView.m" can be changed to additionally check whether the analyzed code point belongs to "CJK Symbols and Punctuation" code points range (U+3000 – U+303F) containing "。" character and, if it is so, to generate "InputMethodEvent".
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/client/jdk/rev/1a8daf81fc7a
            User: alitvinov
            Date: 2015-10-30 10:25:40 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/client/jdk/rev/1a8daf81fc7a User: alitvinov Date: 2015-10-30 10:25:40 +0000
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/1a8daf81fc7a
            User: lana
            Date: 2015-11-25 21:18:22 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/1a8daf81fc7a User: lana Date: 2015-11-25 21:18:22 +0000

              People

              • Assignee:
                alitvinov Anton Litvinov
                Reporter:
                shadowbug Shadow Bug
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: