Help with Unicode? in Tkinter?

Oleg Broytmann phd at phd.pp.ru
Sun Sep 2 14:12:51 EDT 2001


On Sun, 2 Sep 2001, Sheila King wrote:
SK> :SK> UnicodeError: ASCII encoding error: ordinal not in range(128)
SK> :
SK> :   This error indicates that you didn't edit your site.py (or
SK> :sitecustomize.py) and didn't chnge default "ascii" encoding to the encoding
SK> :of your terminal/locale.
SK>
SK> Are you sure? I tried changing my locale to France, and I still get the
SK> same errors I was getting when my locale was not France:

   But did you edit site.py and replace "ascii" with your locale? Or,
better, create the following sitecustomize.py:

# Set the string encoding used by the Unicode implementation.  The
# default is 'ascii'

encoding = "koi8-r" # <= change this!!!

# Enable to support locale aware default string encodings.
import locale
loc = locale.getdefaultlocale()
if loc[1]:
   encoding = loc[1]

if encoding != "ascii":
   import sys
   sys.setdefaultencoding(encoding)

Oleg.
----
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list