Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Is typing hex codes to insert Unicode characters possible when using USB external keyboard on vanilla ICS or Jelly Bean? Any root modifications available to achieve this?

Or, if not possible system-wide, are there any text editing apps that will allow such behavior?

Inserting Unicode characters such as various bullets, subscript and superscript numbers, Greek letters and so on has been very useful while studying. I normally use gedit on a netbook running peppermint distro, because it's very simple and nondistracting while typing my summaries. I've ended up knowing by heart the most used hex codes. I'm planning to replace the netbook by a cheap vanilla ICS tablet (already factory-rooted) and a comfortable, decent USB keyboard, and the described feature would be mostly appreciated.

Thanks in advance!

share|improve this question
    
I know I can keep some special characters in a note and copy-paste them on demand, but I'm looking for a less distractive method that won't require exiting the text editor. –  petruc Jan 26 '13 at 1:11

1 Answer 1

There is a way, actually! By editing system files in a rooted device through ADB. These two pages have the answer:

First, http://source.android.com/tech/input/key-layout-files.html explains how to edit the files that map any key scan codes of your USB keyboard (or even joystick buttons and the device's physical and touch buttons) to standard Android key codes. That's an optional step, useful if there are keys in your keyboard that do nothing in Android, or to remap the ones you don't use (multimedia keys, etc.). There's an app, Key Test by Chris Boyle, that will assist identifying key scan codes from your keyboard.

Then, http://source.android.com/tech/input/key-character-map-files.html shows how to map those Android key codes to Unicode characters when typing, so you can assign, for a given keystroke and modifiers combination, any Unicode character by its hex code, or one of the "magic" hex codes below:

The system reserves two Unicode characters to perform special functions:

'\uef00': When this behavior is performed, the text view consumes and removes the four characters preceding the cursor, interprets them as hex digits, and inserts the corresponding Unicode code point.

'\uef01': When this behavior is performed, the text view displays a character picker dialog that contains miscellaneous symbols.

So to have the behavior I wanted, all that's needed is to assign \uef00 to a key combination. Sweet!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.