encoding problem
Scott David Daniels
scott.daniels at acm.org
Thu Mar 9 09:34:58 EST 2006
Yves Glodt wrote:
> It seems in general I have trouble with special characters...
> What is the python way to deal with éàè öäü etc...
>
> print 'é' fails here,
This should probably stay true.
> print u'é' as well :-(
This is an issue with how your output is connected.
What OS, what code page, what application?
I'm using Win2K, Python 2.4.2
Using Idle, I can do:
print u'élève'
And get what I expect
I can also do:
print repr(u'élève')
which gives me:
u'\xe9l\xe8ve'
and:
print u'\xe9l\xe8ve'
Also shows me élève.
With cmd.exe (the command line):
c:\ python
>>> print u'\xe9l\xe8ve'
shows me élève, but I can't type in:
>>> print u'lve'
is what I get when I paste in the print u'élève' (beeps during paste).
What do you get if you put in:
>>> print repr('élève')
--Scott David Daniels
scott.daniels at acm.org
More information about the Python-list
mailing list