1

I have a console application which is displaying special symbols like

☢ ☍ ⌘ ✰ ⣿ ⚡ ☯ ⚑  ↺  ⤴  ⤵

No matter where - putty(UTF8+Use Unicode line drawing, but I guess it's not client issue), local console, SecureCRT - I can't see them. Instead just squares. Here is my shell env variables

LANG=en_US.UTF-8
TERM=xterm

Any idea how to make terminal to show those symbols correctly?

Update

Glyph I am interested in

python -c 'print u"\u22c5 \u22c5\u22c5 \u201d \u2019 \u266f \u2622 \u260d \u2318 \u2730 " \
    u"\u28ff \u26a1 \u262f \u2691 \u21ba \u2934 \u2935 \u2206 \u231a \u2240\u2207 \u2707 " \
    u"\u26a0\xa0\u25d4 \u26a1\xa0\u21af \xbf \u2a02 \u2716 \u21e3 \u21e1  \u2801 \u2809 " \
    u"\u280b \u281b \u281f \u283f \u287f \u28ff \u2639 \u2780 \u2781 \u2782 \u2783 \u2784 " \
    u"\u2785 \u2786 \u2787 \u2788 \u2789 \u25b9\xa0\u254d \u25aa \u26af \u2692 \u25cc " \
    u"\u21c5 \u21a1 \u219f \u229b \u267a ".encode("utf8")'

Screenshot with Ubuntu font

enter image description here

Screenshot with DejaVu font

enter image description here

Pablo
  • 2,537
  • Because this is a local rendering issue with PuTTY on Windows, the proper answer to your question is that (a) this is neither Ubuntu's fault, nor (b) Ubuntu’s problem. – Jeremy Visser Feb 27 '12 at 12:26
  • 1
    @JeremyVisser: I never said this is Ubuntu problem. Just looking for some way to have similar rendering on Windows. Sorry, I didn't wanted to offend Ubuntu in no way )) – Pablo Feb 27 '12 at 12:32

3 Answers3

3

I just copied the characters from your example and echoed them in a terminal window:

UTF-8 Characters test in GNOME Terminal

I guess TTYs do not have that much character support, so it could be a font issue.

lgarzo
  • 19,832
  • 1
    Definitely a font issue. As long as the terminal is using utf-8 charset, it will be able to handle any utf-8 characters, though if the font doesn't have a symbol for the given character, it will be displayed as a rectangle. – geirha Feb 24 '12 at 17:03
  • Actually I am using server edition, not desktop. The same problem appears when I am connecting from windows using Putty or SecureCRT. I tried all proportional fonts in Putty. Some are partially showing the symbols, but still couldn't find any font that will display all chars. Regional settings is set to English(US) on Putty side. – Pablo Feb 25 '12 at 02:56
  • @Pablo Have you tried the Ubuntu font? (http://font.ubuntu.com/) As far as I know, the terminal uses Ubuntu mono. – lgarzo Feb 27 '12 at 12:06
  • @lgarzo: I've updated original post with screenshot. As you can see the majority of symbols are not displayed. I nailed down the issue to finding Unicode font supporting 2000-29FF unicode ranga as per Wiki http://en.wikipedia.org/wiki/Unicode_fonts . So far Everson Mono is the closest but faaaar away from what your screenshot is. Second is DejaVu Sans Mono but lacking many symbols and not clear. Puzzled... – Pablo Feb 27 '12 at 12:24
  • @Pablo I've tried PuTTY on Linux, it works (got the same results as in the screenshot above). However on Windows PuTTY seems to have different ideas about font encoding despite UTF-8 is selected on the Translation page. (Even the font webpage cannot display all the needed characters in a browser). If the TTFs in the zip are the same as the font in Ubuntu, I cannot put my finger on what's going wrong. – lgarzo Feb 27 '12 at 12:52
  • @lgarzo: same here, banging my head to the wall few days. I thought Unicode is standard among operating systems and Putty is rather mature application. – Pablo Feb 27 '12 at 13:02
  • @Pablo Ok, I've got a workaround, but you might not like it. You can use Cygwin/X as an X server on the Windows PC, and start gnome-terminal on the remote machine displayed on the local server (Windows). It works for my desktop Ubuntu, but might not work for a server (or at least requires some research on what to install). – lgarzo Feb 27 '12 at 13:13
  • @lgarzo: remote machine is headless Ubuntu 10.04 server without any X... and I really don't like installing anything that big on it. The equivalent solution is to install Ubuntu Desktop on Oracle VirtualBox, then connect to my server. Which is of course ugly solution. I still believe it's possible to get such crystal font in Windows. – Pablo Feb 27 '12 at 13:17
  • @Pablo I was a bit wrong about the GNOME Terminal fonts in several ways: 1) By starting gnome-character-map and searching for your special characters I discovered that not all characters are from the Ubuntu Mono font, rather DejaVu Sans. (It can be verified by right clicking on the character.) 2) Windows XP cannot display Braille characters, but Windows 7 can. (Your 5th character is Braille.) It works in PuTTY. 3) Your arrow characters come from TakaoPGothic. It is not a fixed width font and does not come with some of the DejaVu Mono characters you selected. They work on Windows 7. – lgarzo Feb 27 '12 at 16:17
  • @lgarzo: thanks for your analysis. I've updated my original post to a) precisely mention which glyphs I am interested in and b) screenshot with DejaVu Sans. I am using Windows 7. Even my browser doesn't display Braille. It is strange that Ubuntu is trying to get characters from different fonts, unlike(I suppose?) Windows 7. – Pablo Feb 28 '12 at 00:45
  • @lgarzo: I will accept your answer and post more specific question, having all these knowledge. Thanks mate – Pablo Feb 29 '12 at 04:41
  • @Pablo You're welcome! I was thinking about the problem and as a workaround was going to suggest adding the missing characters to the DejaVu Sans font. On Windows 7 they should display, since the Unicode support seems to be better. Thanks, anyway! – lgarzo Feb 29 '12 at 08:51
  • @lgarzo: I dug more in it and found a concept called Composite Fonts. In Windows it's located in Windows -> GlobalMonospace.CompositeFont for monospace and describing mappings to fonts system-wide, including fallbacks. Ubuntu has different composite font mapping. I guess I can try to modify that file, but I am afraid that I will mess how Windows looks like now. Also I don't think it's possible to create and use separate ComposteFont... – Pablo Feb 29 '12 at 09:04
0

I support @lgarzo. You may try some bigger fonts, especially oriental ones:

$ aptitude install ttf-wqy-microhei
WIZARDELF
  • 200
0

... putty(UTF8+Use Unicode ...

Rather than using a hex escape sequence, it maybe easier to use the actual characters to test for resident fonts (if a character is missing this is an oxymoron since it will not be possible to choose it! - which means a source machine must create a file with the desired symbols in it and then display that file with the target machine).

Programmed glyph generation can also be done using character/UTF pairings of unicodes by extraction of UTF-8 or UTF-16:

    python -c 'print "⌘ ✰ ⣿ ⚡ ☯ ⚑ ↺ ⤴ ⤵ ∆ ⌚"'
    ⌘ ✰ ⣿ ⚡ ☯ ⚑ ↺ ⤴ ⤵ ∆ ⌚

    python -c 'print "⌘ ✰ ⣿ ⚡ ☯ ⚑ ↺ ⤴ ⤵ ∆ ⌚".decode("unicode_escape")'
    â Ⱐ⣿ ⡠⯠â ⺠⤴ ⤵ â â

    python -c 'print "⌘ ✰ ⣿ ⚡ ☯ ⚑ ↺ ⤴ ⤵ ∆ ⌚".decode("unicode_escape")
                                                   .encode("unicode_escape")'
    \xe2\x8c\x98 \xe2\x9c\xb0 \xe2\xa3\xbf \xe2\x9a\xa1 \xe2\x98\xaf \xe2\x9a\x91
    \xe2\x86\xba \xe2\xa4\xb4 \xe2\xa4\xb5 \xe2\x88\x86 \xe2\x8c\x9a

    python -c 'print "⌘ ✰ ⣿ ⚡ ☯ ⚑ ↺ ⤴ ⤵ ∆ ⌚".decode("unicode_escape")
                                                   .encode("unicode_escape")
                                                       .decode("string_escape")'
    ⌘ ✰ ⣿ ⚡ ☯ ⚑ ↺ ⤴ ⤵ ∆ ⌚

    python
    Python 2.7.3 (default, Apr 20 2012, 22:44:07) 
    [GCC 4.6.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> u"⌘ ✰ ⣿ ⚡ ☯ ⚑ ↺ ⤴ ⤵ ∆ ⌚"
    u'\u2318 \u2730 \u28ff \u26a1 \u262f \u2691 \u21ba \u2934 \u2935 \u2206 \u231a'

Unicode glyphs can be rendered using UTF-8 or UTF-16
thus Unicode U+2318 or UTF-16: 0x2318 or is UTF-8: 0xE2 0x8C 0x98

Font details for a character can be found by literally searching for it in character map. It is run as an icon utility or activated with the gnome-character-map or gucharmap terminal command. Press and hold the right mouse button over the character to identify the font of residence. Also, use Show only glyphs in this font in the View menu and then scroll through the font list with an arrow key to quickly find the character's font with other resident characters.

enter image description here

oops
previous answer below reiterates the obvious - was looking at answers rather than question


ubuntu@ubuntu:~$ echo '☢ ☍ ⌘ ✰ ⣿ ⚡ ☯ ⚑  ↺  ⤴  ⤵'
☢ ☍ ⌘ ✰ ⣿ ⚡ ☯ ⚑  ↺  ⤴  ⤵

and

python -c 'print u"\xbf  \n FreeSerif\n"  \
  u"\u2019 \u201d \u219f \u21a1 \u21af \u21ba \u21c5 \u21e1 \u21e3 \n" \
  u"\u2206 \u2207 \u2240 \u229b \u22c5 \u22c5\u22c5 \u2318 \u231a \n"  \
  u"\u25aa \u25b9 \u25cc \u25d4 \n"   \
  u"\u260d \u2622 \u262f \u2639 \u266f \u267a \u2691 \u2692 \u26a0 \u26a1 \u26af \n" \
  u"\u2780 \u2781 \u2782 \u2783 \u2784 \u2785 \u2786 \u2787 \u2788 \u2789 \n"  \
  u"\u2707 \u2716 \u2730 \u2a02 \n DejaVu\n"   \
  u"\u2801 \u2809 \u280b \u281b \u281f \u283f \u287f \u28ff \n"  \
  u"\u2934 \u2935 \u254d   \n".encode("utf8")'

prints

¿  
 FreeSerif
’ ” ↟ ↡ ↯ ↺ ⇅ ⇡ ⇣ 
∆ ∇ ≀ ⊛ ⋅ ⋅⋅ ⌘ ⌚ 
▪ ▹ ◌ ◔ 
☍ ☢ ☯ ☹ ♯ ♺ ⚑ ⚒ ⚠ ⚡ ⚯ 
✇ ✖ ✰ ⨂ 
➀ ➁ ➂ ➃ ➄ ➅ ➆ ➇ ➈ ➉ 
 DejaVu
⠁ ⠉ ⠋ ⠛ ⠟ ⠿ ⡿ ⣿ 
⤴ ⤵ ╍   

using gnome-terminal

ubuntu@ubuntu:~$ echo \$TERM = $TERM \  \$LANG = $LANG
$TERM = xterm   $LANG = en_US.UTF-8

and

ubuntu@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04 LTS
Release:    12.04
Codename:   precise
ubuntu@ubuntu:~$ 

note: EOT and ENQ symbols are wrong
ref: How can unicode symbols u+2404 ␄ EOT and u+2405 ␅ ENQ be corrected?

python -c 'print u"This is ^D EOT (NB!! no ;) \u2404 and ENQ ^E \u2405 ".encode("utf8")'
This is ^D EOT (NB!! no ;) ␄ and ENQ ^E ␅