Python print Unicode does not display valid characters

I am using Ubuntu 12.04 LTS. When I try something like this in the terminal:

rfx@digest:/usr/share/fonts/truetype/ttf-dejavu$ echo   

Symbols are displayed correctly. But if I try to print Unicode characters using python 2.7, I get the following:

 >>> print u'' │┌≈ 

As python shows, I have the default utf-8 encoding for the terminal:

 >>> sys.stdout.encoding 'UTF-8' 
+8
python ubuntu python-unicode
source share
1 answer

Your input is not properly processed by the terminal. This is not a Python issue.

To prove this, use the unicode view:

 myunicode = u'\u0430\u0431\u0432' print myunicode print myunicode.encode('utf-8') 

If this does not print the original line twice, then you need to properly configure the terminal emulator program.

+5
source share

All Articles