vx / connectbot

Enhanced version of the popular ConnectBot SSH and telnet client
http://connectbot.vx.sk
Apache License 2.0
193 stars 62 forks source link

Combined accentuated characters can't by typed #49

Closed rakovs closed 11 years ago

rakovs commented 11 years ago

On TF700T, slovak accentuated characters that need to be combined from two keystrokes can't be entered on physical keyboard. For example ó needs to be typed as acute and o, but this doesn't work.

Some characters can be entered in unexpected ways - e.g. Č works by pressing caron and then backspace. This is due to a fact, that backspace key has a keycode of 67 which is exactly the ASCII code for letter C.

For combined characters, VX Connectbot doesn't translate raw keycode of the second pressed key into corresponding ASCII character and instead delivers the raw keycode to the terminal window. This obviously fails, since raw keycode for A is 29 - but we need its ASCII value (65).

The problem seems to be in TerminalKeyListener.java, line 241 in this code snippet:

if (mDeadKey != 0) { uchar = KeyCharacterMap.getDeadChar(mDeadKey, keyCode); mDeadKey = 0; }

keyCode needs to be translated into ASCII value first (getUnicodeChar?)

rakovs commented 11 years ago

I think the problem could be solved by applying the following patch:

--- TerminalKeyListener.java.orig   2013-01-10 14:47:29.000000000 +0100
+++ TerminalKeyListener.java    2013-01-10 14:47:58.000000000 +0100
@@ -238,8 +238,8 @@
                return true;
            }

-           if (mDeadKey != 0) {
-               uchar = KeyCharacterMap.getDeadChar(mDeadKey, keyCode);
+           if (mDeadKey != 0 && uchar != 0) {
+               uchar = KeyCharacterMap.getDeadChar(mDeadKey, uchar);
                mDeadKey = 0;
            }
mmatuska commented 11 years ago

Are you sure the patch will do the job? Can I send you a test build? Please send me your e-mail.

rakovs commented 11 years ago

If you could make a test build, I'll be glad to test. My email : rakovsk (at) gmail (dot) com