JDK-8132503 : [macosx] Chinese full stop symbol cannot be entered with Pinyin IM on OS X
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8u51
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2015-07-29
  • Updated: 2016-04-27
  • Resolved: 2015-10-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 JDK 9
8u101Fixed 9 b94Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
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 "���".
Comments
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".
27-10-2015

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.
04-09-2015