string encoding problem
Chad Netzer
cnetzer at mail.arc.nasa.gov
Wed Nov 20 18:18:44 EST 2002
On Wednesday 20 November 2002 14:34, Rodolphe wrote:
> Hi everybody,
>
> I've got the very short code :
>
> import tkSimpleDialog
> str = tkSimpleDialog.askstring('Bug','Say something...')
> print str
>
> And when I run it and enter a string containing accented characters (like
> "fenêtre"), I've got this :
> UnicodeError: ASCII encoding error: ordinal not in range(128)
Since Martin already answered, I'll just provide a link which I found
helpful:
http://www.reportlab.com/i18n/python_unicode_tutorial.html
Furthermore, I want to let you know that using 'str' as a variable name is
not advised, since it masks the builtin str() constructor (which at first
glance I thought might be related to your problem). For throwaway string
variables, I often just use 's'.
--
Bay Area Python Interest Group - http://www.baypiggies.net/
Chad Netzer
cnetzer at mail.arc.nasa.gov
More information about the Python-list
mailing list