2013年7月31日水曜日

[android]OpenWnnでALT+E押すと強制終了する

OpenWnnでALT+E押したら強制終了したからなんでだろうっていう話。

答えはこれ
http://developer.android.com/reference/android/view/KeyEvent.html#getUnicodeChar(int)
If the return value has bit COMBINING_ACCENT set, the key is a "dead key" that should be combined with another to actually produce a character -- see getDeadChar(int, int) -- after masking with COMBINING_ACCENT_MASK.

KeyEventのUnicodeくださいするときはDeadKeyじゃないか確認してね、とのこと。
OpenWnnはこの処理が抜けていたわけで。

修正はマスクをするだけ
 if ((charCode & KeyCharacterMap.COMBINING_ACCENT) != 0) {
     charCode = charCode & KeyCharacterMap.COMBINING_ACCENT_MASK;
 }

みんな頑張って

0 件のコメント:

コメントを投稿