non-English characters in Linux

It’s easy to make accented characters (e.g. é and ü) in Linux. Easier than in Windows, actually, because in Windows you have to remember all those crazy Alt codes, and in Linux, it’s logical combinations of accents and letters.

  1. You need a command-line program called xmodmap. If you’re not sure you have this, run the following command in a term/console: which xmodmap. You’ll probably get something like the following:
    sarah@imp:~$ which xmodmap
    /usr/bin/X11/xmodmap
    This shows that you have xmodmap installed, and it happens to be located at /usr/bin/X11/xmodmap. Peachy.
  2. Run the following command in a term:
    xmodmap -e "keysym Alt_R = Multi_key"
    This assigns your right Alt to be your “multi-key.” Your multi-key is the key you’ll press to tell the computer you’re about to make an accented character.
  3. Now you’re all set! The basic idea is to hit a key sequence, beginning with your multi-key, and then two characters you wish to combine. For example, to make an é, you would hit Alt ' e. That’s right-Alt, release, apostrophe, release, e. Or, you can hold down all the keys at once (i.e. right-Alt + apostrophe + e). You can also produce é if you hit the e before the apostrophe, as long as you begin the sequence with your multi-key.

    Note that your term might not recognize the accented characters, and so you should probably do your testing in some place like a browser or text editor.

Voilà. Now you can type your French papers much more quickly, because you won’t have to select individual characters from some symbol chart in your word processor, and you can correspond with your German friends on gaim just as quickly, because you won’t have to copy and paste accented characters from some site.

A note: if you like writing your documents in OpenOffice, you may have some trouble with entering accented characters because OpenOffice always seemed to ignore the Alt key sequences, at least for me with version 1.1.0. I recommend instead, if you’re going to be writing something that involves non-English characters, a word processor called AbiWord. It’s simpler than OpenOffice and it lets you type in the accented characters.

Sample Key Combinations

For these sample sequences, I assume that your multi-key is Alt.

Combination Result
Alt s s ß
Alt ? ? ¿
Alt ! ! ¡
Alt ` o (that’s a back tick) ò
Alt ^ a â
Alt " u (those are quotes, not two apostrophes) ü
This entry was posted in Geeky and tagged , , while listening to Stone Temple Pilots - Wonderful, by Sarah. Bookmark the permalink.

12 thoughts on “non-English characters in Linux

  1. I’Ve got one problem regarding this… I assigned my left alt key to do this, as you know, but upon rebooting my computer, the left alt doesn’t work in that way anymore. Shouldn’t assigning this key mean it STAYS assigned? I shouldn’t have to reassign it ever time I reboot, should I?

  2. Actually… Yes, that’s the way it works. You can put the xmodmap command in a script that gets executed every time you reboot back into Linux. For example, my window manager IceWM has a “startup” file that is executed as soon as I load IceWM. Or, a ghetto solution if you don’t mind receiving an error message every time you open a term, is to put the command in a file called .bashrc in your home directory. Assuming you use bash as your shell, and not something like csh or zsh. To test and see which shell you use, do the command echo $SHELL in a term.

  3. I know this is kinda late, but an easy way to get this to work at startup (in Ubuntu at least) is to do a sudo nano /etc/init.d/bootmisc.sh and insert the xmodmap command that you use at the bottom of the file (but before the : exit 0 line, be sure of that ;)), save it, reboot, and it still works! Far easier than doing .bashrc editing, IMO. :D

  4. I’ve actually put this in my ~/.bash_profile which is only run on invoking non-interactive sessions (e.g. logging in). So it won’t be run every time you open a terminal. I think some distros handle this differently, but this is the gist.

    Also, to avoid the error printing, just add ‘&> /dev/null’ to the end. Be warned, though; this will not print anything, even something that may be useful. So only add it after you’re sure it’s working as it should.

    But let me say, ït îs for me! :)

  5. Hello from Belgium !
    i am a Ubuntu newbie and have a Qwerty
    Keyboard ,choose Dutch as Keyboard layout
    but @ doesnot show up .Copy and pasting it does work, but thats not the way….
    Thanks

  6. Not all people are using window managers that have taskbars, or that offer such features. I know for a long time I used Blackbox due to its simplicity, and I never found a ‘special character applet’ that I could’ve put on my taskbar. Before that was fvwm2, which didn’t even have a taskbar in my setup.

  7. I find the best key to use with this is the right Windows key. This, for anyone who doesn’t know, is Super_R.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>