How can I type a Unicode character (for example, em-dash —?)

86,585

Solution 1

  • Ctrl+Shift+U, then 2 0 1 4 and Enter

or

  • Ctrl+Shift+U+2014

Control-capital-u means Unicode, and the four-digit hexadecimal number for em dash (or any other Unicode character) can be found via the Character Map in Ubuntu (gucharmap).

The first option allows you to separately type the correct digits for your character, which appears upon hitting Enter or Space. You can also edit the numbers you typed using backspace before pressing Enter.

If this shortcut doesn't work check if your input method is iBus.

Solution 2

I could not find a way to type it using AltGr and default settings, but I found another way:

  1. Go to System -> Preferences -> Keyboard.

  2. Select the Layouts tab.

  3. Click Options.

  4. Under Compose Key Position (drop-down), choose a key to use for composing — I chose the Right Win (right Windows key).

  5. Now press and release the compose key, then type --- to get the em-dash.

[Here's a list of more characters you can type this way.]


UPDATE: As of Ubuntu 12.04

  1. Go to System Settings > Keyboard.

  2. Under Typing tab, select Layout Settings link (at the bottom of the dialog box).

  3. Click Options.

  4. Under Compose key position (drop-down), choose a key to use for composing — I chose the Right Win (right Windows key).

  5. Now press and release the compose key, then type --- to get the em-dash.

Solution 3

  1. Go Character Map app (gucharmap, on Applications → Accessories).

  2. Click Search → Find

    screenshot

  3. Type 'em dash' and click 'Find Next'

    screenshot

  4. Double-click the symbol, which will put it in the 'Text to Copy' box at the bottom.

    screenshot

  5. You can then copy-and-paste it where you want it.

    screenshot

Solution 4

I believe this is the best way to have some special chars, but I don't know if it works with all keyboards.

In my Brazilian ABNT2 keyboard I can get it with the Compose key more tree hyphens. The compose key is mapped to my right Ctrl key, so:

  • Right Ctrl--- (in the comments some people say that you must press Control before the hyphens, I can press it simultaneously) (—)

To get the en dash, use Ctrl --. (hyphen, hyphen, dot)

  • Right Ctrl--. (–)

A bonus one, for the … type:

  • Right Ctrl.. (…)

You can configure your Compose key in: settings → keyboard → shortcuts → typing.

Solution 5

Autokey

A generalised method for any unicode character

Many of the answers above are either specific to the em dash, require memorizing alt codes, or are better suited for one-off uses. The following works for any unicode character without alt codes. It uses Autokey, a handy text substitution utility.

I have it set up such that I type the name of a character, prepended with a slash, and Autokey converts it for me. For example:

enter image description here

Full instructions with pictures here. Summary below. (Also, similar methods here)

  1. Install the python-3 version of Autokey, which plays nicely with Unicode.

    # Edit (April 2018). Autokey now uses python 3 by default. So try
    pip3 install autokey
    
    # Original instructions.
    # Install the original autokey
    sudo apt-get install autokey-gtk
    # Update autokey to python 3 using pip3 
    pip3 install --user autokey-py3
    
  2. Run the program. For me it installed to ~/.local/bin/autokey-gtk

  3. Add a "New Phrase"

  4. Add the desired character in the main text box

  5. Add an abbreviation

  6. Profit

Share:
86,585

Related videos on Youtube

Timoun
Author by

Timoun

I used to use this acccount

Updated on September 17, 2022

Comments

  • Timoun
    Timoun almost 2 years

    The title pretty much says it all: how can I type Unicode characters - specifically the em-dash —?

    • Admin
      Admin over 4 years
      Not a general solution, but indeed the em-dash can be had with altGr+- (under Ubuntu-MATE at least, for a couple of years now). There are quite a few more around altGr+something (ellipsis, fractions, multiply-×,...)
  • Jammerz858
    Jammerz858 over 13 years
    Or you could just bookmark this page and copy and paste it from the question :)
  • frakorn
    frakorn over 13 years
    Setting up compose keys is much easier than having to use the character map every time you want a special character.
  • Nathan Osman
    Nathan Osman over 13 years
    @jrt: It allows you to insert the character without altering your keyboard layout. Not everyone wants to change their layout just to type a dash.
  • Jammerz858
    Jammerz858 over 13 years
    Works for me. Didn't need to press enter though, the — appears as soon as i release ctrl and shift.
  • jjd
    jjd over 13 years
    Yes, if you keep Ctrl+Shift held the whole time while typing the numbers, then it will appear immediately. If you release them before typing the numbers (which allows you to also use backspace) then a Space or Enter is required to show the end of the Unicode number input process.
  • Santhosh kumar
    Santhosh kumar over 13 years
    Note that there is no need to hold the compose key after it was pressed.
  • Timoun
    Timoun over 13 years
    Yowza, that's nice: type any Unicode character on codepoint. If only it had a character search capability.
  • Oxwivi
    Oxwivi about 13 years
    @Beau, use the Character Map to search.
  • bunter
    bunter almost 13 years
    I wasn't aware that the Character Map had a search option until reading this. Not sure if I'll ever use it, but +1 for enlightening us. (Please vote to delete the "answer" I left below... it was supposed to be a comment here.)
  • Fran Marzoa
    Fran Marzoa about 11 years
    I find this method better than the selected answer. It is a lot of easier for both, remember it and typing it.
  • metakermit
    metakermit over 10 years
    This is the most human method, thanks! You can set the compose key in settings—keyboard—shortcuts—typing. Right control is OK, as it doesn't clash with other modifiers.
  • x-yuri
    x-yuri almost 10 years
    ubuntu 13.10: System Settings > Keyboard > Shortcuts > Typing > Compose Key
  • Iluvathar
    Iluvathar almost 10 years
    Note that this only works for GTK applications. It won't it any Qt-based one, for example (thus the whole KDE and many individual apps like Skype).
  • jjd
    jjd almost 10 years
    @Ruslan: ISO 14755 is the standard. There appears to be some dispute between QT #8 verses KDE #103788 verses X#26747 regarding how best to get it fixed for Qt applications. A (sub-optimal) workaround would be to entry the character(s) into the Firefox URL bar or Gedit and copy-and-paste it them.
  • Iluvathar
    Iluvathar almost 10 years
    @sladen surely it is the standard. But this unfortunately doesn't make it implemented at the right level (i.e. XIM).
  • nephewtom
    nephewtom over 8 years
    Mmm... This does not work on Ubuntu 14.04 as Ctrl+Shift+U does not seem to work. Do I need to configure something in keyboard settings? I am testing it with gedit 3.10.4 and Ctrl+Shift+U then 2,0, 1, 4 and Enter displays 2014, and Ctrl+Shift+U+2014 displays )!$
  • Aaron Franke
    Aaron Franke about 8 years
    This does not work in Ubuntu 16.04 now that Mir has replaced X11. Help? askubuntu.com/questions/768191/…
  • Jezzamon
    Jezzamon over 7 years
    @nephewtom If you use the numpad, you can hold hold Ctrl+Shift and release when you're done. If you use the number row, you need to release Shift and/or Ctrl before typing in the numbers. If you release both you need to press Enter or Space to confirm. If you release Shift first, then you can confirm by releasing Ctrl when you're done.
  • Peeyush Kushwaha
    Peeyush Kushwaha about 7 years
    It's a good idea to combine this (to find the code for your character) with the accepted answer. In ubuntu 16, just type in "character map" in the dash to find the character map and then hit ctrl+f for the find menu
  • stafusa
    stafusa over 5 years
    In my browser and shell <(Right) Ctrl>+<-> is a shortcut for reducing the font size, so that doesn't work.
  • JKHA
    JKHA about 4 years
    This doesn't work with Ubuntu 18.04
  • user3590305
    user3590305 over 3 years
    @Ruslan It's not that unusual. I've never had a UK keyboard without two; the second is right of AltGr, left of the Menu key (RCtrl on the end). I'm sure laptop keyboards and other small keyboards will omit it, but it seems very common on full size keyboards.
  • cipricus
    cipricus almost 3 years
    @stafusa - In fact hold control while pressing all the hyphens can be misleading here. You don't have to hold the Compose key while pressing the hyphens etc, it is meant to be pressed and released, that is before the rest. - Already here an even older answer says it clearly.
  • cipricus
    cipricus almost 3 years
    @JKHA - I doubt that. Try setting a different Compose key. (For example, in order to avoid interference with keys like Alt, Ctrl or Win/Super, I use the Pause key, which on my laptop is Fn+Right_Shift.)
  • cipricus
    cipricus almost 3 years
    +1 for the en dash info. But the Compose has to be pressed&released, not held.
  • stafusa
    stafusa almost 3 years
    @cipricus Actually, both options work (when they do) — at least in my system, either keeping it pressed or releasing it produces the character. But thanks to calling my attention to it being the Compose key, not necessarily <Ctrl>.