... assuming it supports Unicode ?


First, make sure you've started xterm in a UTF-8 locale, either via the LC_CTYPE environment variable or with the locale resource (which can be set from the command line). The environment variable method is recommended since it applies to all applications; if you've set up Unicode system-wide, it's probably there already.

Now, to insert unicode characters... Type them on your keyboard. Yes, really. It's not really xterm's job to facilitate the input of arbitrary characters: X already has features for this. Which of these features is best for you depends on the language(s) you want to type.

  • Most keyboard layout for languages based on the latin alphabet have an AltGr key to access the third and fourth (with shift) characters on a key. You can even go up to 8 symbols by configuring an ISO_Level3_Shift key.

  • There are standard ways of switching between alphabets, typically used by layouts for languages using non-latin alphabets. I'm not familiar with them so can't offer pointers.

  • Traditional Unix keyboards often have a Compose, which is the most mnemonic way of entering characters with diacritics and other modifications, e.g. Compose ' e ​→ é, Compose o e ​→ œ, Compose space space ​→ unbreakable space, etc. PCs don't have a key labeled “Compose”, so on most Linux distributions the key needs to be enabled explicitly (the “menu” key just left of the right Ctrl key on most PC keyboards is a common choice).

  • Going further, and practically necessary to type in non-alphabetical scripts, there are fancier input methods such as SCIM and UIM. There are several different programs available, and how to set them up depends on your system (Ubuntu, Fedora, ...).

  • Some editors, such as Vim and Emacs, have their own input methods that you can use with any interface.

If you need an unusual character as a one-off, you can copy-paste it from somewhere (such as unicode.org, although they don't make it particularly easy). There are “character map” applications, such as Gucharmap and KCharSelect, where you can browse the Unicode database or search a character by name then copy it to the clipboard. If you want to stay in the terminal, you can use the unicode program, which is a sort of command-line-based character map.

| improve this answer | |
  • Thanks for the exhaustive answer ! I'm kinda surprised xterm doesn't offer an easy way of entering Unicode chars, like vim or gnome-terminal. From Dennis' answer, they're working on it; until it's ready, copy-paste :| – Mihai Rotaru Sep 28 '10 at 11:42

On my system, I can hold Alt or Shift-Alt and press most keys to get various characters. I don't know of a way to do general character entry. The xterm website FAQ says:

Ongoing/future work

popup window that shows hex code for content of a character cell and hexadecimal keyboard entry for all Unicode characters (ISO 14755)

In gnome-terminal you can press Ctrl-Shiftu which will display an underlined "U" then type in the four-digit hex code and press enter. Using 03a3 gives "Σ" for example.

| improve this answer | |
  • 1
    Getting accented characters with Alt is a result of having the “Meta sets 8th bit” resource set (it's called somewhat misleadingly eightBitInput). It's a historical survivance from the days when 8 bits were more than enough for everybody and merely going beyond 7 bits labeled you as a weirdo. It's only good for inputting characters 160–254, and even then with a very non-mnemonic layout. Furthermore most applications (basically everything but nethack) expect that Meta sends escape. – Gilles 'SO- stop being evil' Sep 27 '10 at 20:16
  • <Ctrl>-<Shift> <u> works very well on Manjaro Linux. I can even create queries against mysql using Unicode chars now. – Fabio Montefuscolo Feb 21 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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