-   Linux - Newbie (
-   -   How do I insert special character with alt? (

Meriadoc 11-26-2004 04:21 AM

How do I insert special character with alt?
I've seen this question asked a few times before, but in different ways so here goed. In Windows you can insert a special character (accented e for instance) by pressing ALT and tapping in the ASCII code for the character. I haven't found a way to do this in Linux yet, but I can't believe no one has ever made a bit of code to produce this behaviour, I think I'm just unable to find it. So here's my question: does anyone know where I can find an applet (or something) that emulates the DOS behaviour of ALT+code=insert special character.

(This is not intended to be insulting, but I'm not looking for a workaround or a tutorial on mapping keys, I've found plenty of those. If you can tell me that the above behaviour is simply impossible in Linux, al least I can stop wasting my time looking for it, so I'd be grateful for that too.)

rjlee 11-26-2004 04:41 AM

It's not impossible to do (what is in Linux?!?) but I haven't found anything to do this after a cursory Freshmeat search.

With the current abstration layers in Linux, this isn't something that's very easy to do.

One problem is that you've no idea which character set the kernel is configured to use natively; it could be a simple 8-bit ASCII varient, 16-bit unicode or (most commonly with new distros) UTF-8, where most characters are 8 bits but some are 16. 8-bit codes range from 0 to 255, while 16-bit codes go up to 65535, so how many numbers should you type in? Also, the character mappings are different for the terminal than they are for X-Windows, because of the event-driven nature of X.

IMHO, the Alt-number combination is really just a Windows work-around for the difficulty of mapping a scancode to a keycode (you have to design an entire character set and then load it all, so changing one key isn't portable across different character sets). It may be slightly more work initially to map a new character in Linux or X, but it does mean that you can actually type properly with the new character.

Meriadoc 11-26-2004 04:47 AM

Thanks for the quick and complete reply, although it did kill my ambition to quickly program this 'simple applet' myself ;) I'll start mapping keys then.

rjlee 11-27-2004 07:29 PM

If you just want a Windows-compatibility alt-key “applet”, then that's not too hard; you just assume that the user's using ISO-8859-1 or whatever. (It would be better to make the codepage be selectable)

goossen 05-17-2006 11:19 AM

But it works for the "Text Mode"! Is there any method to make it work on X-Windows too?

tredegar 05-17-2006 11:42 AM

Some unusual characters are already mapped to the key combination [Right "Alt GR" Key] & [Another key].
Eg try [Right "Alt GR" Key] and m - you get the greek mu symbol: µ
I don't think all keys are mapped, and I do not know where this happens.


All times are GMT -5. The time now is 08:16 PM.