You are not logged in.
Pages: 1
After some non-concluding searchs on google, I ask for help about something I don't really understand. It's about python and unicode. I'm trying to print some unicode characters in a terminal. Here's an example :
#!/usr/bin/env python
# -* coding: utf-8 -*-
print "─├"
Output :
ââ
So I tried it this way :
#!/usr/bin/env python
# -* coding: utf-8 -*-
print u"─├".encode('utf-8')
And this way :
#!/usr/bin/env python
# -* coding: utf-8 -*-
print u"u2500u251c".encode('utf-8')
But I get the same output... Well, I think there's something I don't understand about python's way to handle unicode strings. One thing I know, it's not coming from my terminal because I get the same output in xterm, urxvt and terminal (xfce's one) and I can see those chars in ncurses applications.
Could someone be good enough to tell me what am I doing wrong ?
Thanks.
(looks like arch's bbs don't like unicode strings, if you want to see what kind of characters I'm trying to print, go http://fr.wikipedia.org/wiki/Table_des_ … code/U2500 )
Offline
>>> print u'Hellou0020World'
Hello World
Offline
There can be issues with printing to terminals - often it depends on the supported encoding of the terminal itself. Always check by redirecting output to a file and looking at the unicode text in a text editor. If it's looking as expected, then you can play around with terminal settings, etc.
Offline
Pages: 1