Help with Unicode? in Tkinter?

Oleg Broytmann phd at
Sun Sep 2 20:12:51 CEST 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 (or
SK> and didn't chnge default "ascii" encoding to the encoding
SK> :of your terminal/locale.
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 and replace "ascii" with your locale? Or,
better, create the following

# 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

     Oleg Broytmann              phd at
           Programmers don't die, they just GOSUB without RETURN.

More information about the Python-list mailing list