idle6.0 german umlauts (ascii > 128 Exception)

Alex Martelli aleaxit at
Tue Nov 7 14:21:37 CET 2000

"Syver Enstad" <syver.enstad at> wrote in message
news:8u7dp0$vif$1 at
> A little experiment... Copy my Ä from this mail and paste it into idle and
> see what happens.

On my machine (NT SP6 configured as 'US'), I get a traceback, which
boils down to:

UnicodeError: ASCII encoding error: ordinal not in range(128)

if I try to do x='Ä' in IDLE.  In PythonWin, it works fine (and
print x does show uppercase-A-with-umlaut), as it does in the
command-line interactive interpreter (with a different encoding,
though; repr(x) is '\304' for Pythonwin, '\216' for the command
line -- yes, I _have_ used copy-and-paste of the identical
characted in each case).

That's on stock-Python, with
>>> sys.getdefaultencoding()

as set by the default

The corresponding locale.getdefaultlocale() situation:

>>> import locale
>>> locale.getdefaultlocale()
('en_US', 'cp1252')

identically in all 3 environments, of course.

Adding a to set the default encoding to
the same as the default locale's codepage, i.e. here:

import sys

or, also,


makes no difference to either PythonWin or the interactive
commandline (they both keep working, as they did before --
with different codes, but correctly in themselves...),
and 'fixes' IDLE so it works like Pythonwin (code \304
for the uppercase-A-with-umlaut).

I'm not sure this procedure is "correct", but, I guess
you may want to give it a try...


More information about the Python-list mailing list