5

For example I want to print long dash

I read that it's possible to do with numpad and code of Unicode of character, so I tried doing Alt+Shift+u + code, but without success.

Zanna
  • 70,465
mystdeim
  • 429

2 Answers2

5

You want Ctrl and not Alt. This

ctrl+shift+U then 2014enter

is giving me . Note that the output depends on your locale settings.

Zanna
  • 70,465
  • 1
    @heemayl You edited this to say "the output depends on your locale" without anything to substantiate or explain this. Can you explain? How does it depend on that, and which process's locale settings (since they are in the environment, per process) affect this? The terminal emulator? I am not familiar with any situations where locale settings affect the appearance of characters entered into a terminal, but I am far from an expert on these matters. I think another edit could clarify precisely what you mean; right now, I don't think there's any way for anybody to use the added information. – Eliah Kagan Apr 19 '18 at 20:37
5

As stated in Ubuntu help page the proper way is the following:

  1. Press Ctrl + Shift + u
  2. Type in hexadecimal code for Unicode character you want to print
  3. Press enter

Alternative approach is to use printf (or echo -e) command in terminal and copy the output. For example, to print copyright sign do

$ printf "\u00a9"                                                              
©
$ echo -e "\u00a9"                                                              
©

Python can do the same, except you need to prepend u in the beginning of hexadecimal string. For instance,

$ python -c 'print u"\u00a9"  '                                                
©

Command line ways can be useful in conjunction with xclip program, which basically copies stuff you give it to clipboard. For example, I could do :

 printf "\u00a9"  | xclip -sel clip
heemayl
  • 91,753
Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497