How to print a unicode string?
bbxx789_05ss at yahoo.com
Sat Apr 19 02:36:12 CEST 2008
On Apr 18, 5:38 pm, damonwisc... at gmail.com wrote:
> I'd like to print out a unicode string.
> I'm running Python inside Emacs, which understands utf-8, so I want to
> force Python to send utf-8 to sys.stdout.
> From what I've googled, I think I need to set my locale. I don't
> understand how.
> import locale
> print locale.getlocale()
> --> (None,None)
> print locale.getdefaultlocal()
> --> ('en_GB','cp1252')
> print locale.normalize('en_GB.utf-8')
> --> en_GB.UTF8
> --> locale.Error: unsupported locale setting
> I'd be grateful for advice.
u_str = u'hell\u00F6 w\u00F6rld' #o's with umlauts
More information about the Python-list