How can I type a Unicode character (for example, em-dash —?)
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:
Go to System -> Preferences -> Keyboard.
Select the Layouts tab.
Click Options.
Under Compose Key Position (drop-down), choose a key to use for composing — I chose the Right Win (right Windows key).
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
Go to System Settings > Keyboard.
Under Typing tab, select Layout Settings link (at the bottom of the dialog box).
Click Options.
Under Compose key position (drop-down), choose a key to use for composing — I chose the Right Win (right Windows key).
Now press and release the compose key, then type
---
to get the em-dash.
Solution 3
-
Go Character Map app (
gucharmap
, on Applications → Accessories). -
Click Search → Find
-
Type 'em dash' and click 'Find Next'
-
Double-click the symbol, which will put it in the 'Text to Copy' box at the bottom.
-
You can then copy-and-paste it where you want it.
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:
Full instructions with pictures here. Summary below. (Also, similar methods here)
-
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
-
Run the program. For me it installed to
~/.local/bin/autokey-gtk
-
Add a "New Phrase"
-
Add the desired character in the main text box
-
Add an abbreviation
-
Profit
Related videos on Youtube
Comments
-
Timoun almost 2 years
The title pretty much says it all: how can I type Unicode characters - specifically the em-dash —?
-
Admin over 4 yearsNot 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 aroundaltGr+something
(ellipsis, fractions, multiply-×
,...)
-
-
Jammerz858 over 13 yearsOr you could just bookmark this page and copy and paste it from the question :)
-
frakorn over 13 yearsSetting up compose keys is much easier than having to use the character map every time you want a special character.
-
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 over 13 yearsWorks for me. Didn't need to press enter though, the — appears as soon as i release ctrl and shift.
-
jjd over 13 yearsYes, 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 over 13 yearsNote that there is no need to hold the compose key after it was pressed.
-
Timoun over 13 yearsYowza, that's nice: type any Unicode character on codepoint. If only it had a character search capability.
-
Oxwivi about 13 years@Beau, use the Character Map to search.
-
bunter almost 13 yearsI 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 about 11 yearsI find this method better than the selected answer. It is a lot of easier for both, remember it and typing it.
-
metakermit over 10 yearsThis 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 almost 10 years
ubuntu 13.10
:System Settings
>Keyboard
>Shortcuts
>Typing
>Compose Key
-
Iluvathar almost 10 yearsNote 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 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 orGedit
and copy-and-paste it them. -
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 over 8 yearsMmm... 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 andCtrl+Shift+U
then2
,0
,1
,4
andEnter
displays2014
, andCtrl+Shift+U+2014
displays)!$
-
Aaron Franke about 8 yearsThis does not work in Ubuntu 16.04 now that Mir has replaced X11. Help? askubuntu.com/questions/768191/…
-
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 releaseShift
and/orCtrl
before typing in the numbers. If you release both you need to pressEnter
orSpace
to confirm. If you releaseShift
first, then you can confirm by releasingCtrl
when you're done. -
Peeyush Kushwaha about 7 yearsIt'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 over 5 yearsIn my browser and shell <(Right) Ctrl>+<-> is a shortcut for reducing the font size, so that doesn't work.
-
JKHA about 4 yearsThis doesn't work with Ubuntu 18.04
-
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 almost 3 years@stafusa - In fact
hold control while pressing all the hyphens
can be misleading here. You don't have to hold theCompose
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 almost 3 years@JKHA - I doubt that. Try setting a different
Compose
key. (For example, in order to avoid interference with keys likeAlt
,Ctrl
orWin/Super
, I use thePause
key, which on my laptop isFn+Right_Shift
.) -
cipricus almost 3 years+1 for the
en dash
info. But theCompose
has to be pressed&released, not held. -
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>.