You are not logged in.

#1 2020-05-02 23:17:54

doubleslash
Member
Registered: 2011-08-16
Posts: 80

[SOLVED]How to print unicode symbols

Hi,
I can't print special unicode symbols when going into Python console. At the xterm I enter

python

Then in the python console, I enter

>>>print("\N{ALEF SYMBOL}")

and the output is a mangled up char. Writing the char to a file and opening it in an editor (geany) shows python works correctly. So, I tried installing this Hebrew font AUR package, thinking it's due to missing fonts, but that didn't fix it.


My system is as follows:
xterm with locale set to en_US_UTF-8.
Thanks

Last edited by doubleslash (2020-05-03 04:05:39)

Offline

#2 2020-05-02 23:20:29

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,698
Website

Re: [SOLVED]How to print unicode symbols

doubleslash wrote:

My system is as follows:
xterm with locale set to en_US_UTF-8.
Thanks

That's not correct as it is not a valid locale.
Please provide the output of

localectl

Inofficial first vice president of the Rust Evangelism Strike Force

Offline

#3 2020-05-02 23:35:03

doubleslash
Member
Registered: 2011-08-16
Posts: 80

Re: [SOLVED]How to print unicode symbols

localectl output

   System Locale: LANG=en_US.UTF-8
       VC Keymap: n/a
      X11 Layout: n/a

Offline

#4 2020-05-03 00:03:29

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,698
Website

Re: [SOLVED]How to print unicode symbols

So your locale is set correctly to en_US.UTF-8, not en_US_UTF-8 as you mentioned in your initial post.
Which console font are you using?


Inofficial first vice president of the Rust Evangelism Strike Force

Offline

#5 2020-05-03 00:32:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,516
Website

Re: [SOLVED]How to print unicode symbols

schard wrote:

Which console font are you using?

Console (as in tty) or xterm?  It sounds like the problem is just displaying the character in xterm.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2020-05-03 02:34:58

doubleslash
Member
Registered: 2011-08-16
Posts: 80

Re: [SOLVED]How to print unicode symbols

How do I check for that?

Offline

#7 2020-05-03 02:40:24

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,516
Website

Re: [SOLVED]How to print unicode symbols

You configured it, so you should know.

https://wiki.archlinux.org/index.php/Xt … figuration


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2020-05-03 04:04:55

doubleslash
Member
Registered: 2011-08-16
Posts: 80

Re: [SOLVED]How to print unicode symbols

After looking around, I still can't find a way to know which font I'm using. However, I found a solution to my problem. I'll reproduce the steps here for others.
1. Follow font guide page to search for a font that supports UTF. You can either pacman -Ss or in my case I found the gnu-free fonts in one of the lists. Install it with pacman
2. Set font size and name in ~/.Xresources to your preference

xterm*faceName: /usr/share/fonts/gnu-free/FreeSans.otf
xterm*faceSize: 14
xterm*renderFont: true

3. Restart xterm or do

xrdb -merge ~/.Xresources

Thanks

Offline

Board footer

Powered by FluxBB