idle6.0 german umlauts (ascii > 128 Exception)

Walter.Zettel Walter.Zettel at t-online.de
Tue Nov 7 11:27:39 EST 2000


Hello all responders,

thank you for your help. I got another hint by someone, who reads this ng:

in lib/site.py there is a line:

encoding="ascii"

I changed it to:

encoding="latin1"

and this works for me.

But now I have one more question:

Is this the official way to do it? Or have I to do somethin like "import
local"

--
cu Walter


"Alex Martelli" <aleaxit at yahoo.com> schrieb im Newsbeitrag
news:8u8vl201cis at news1.newsguy.com...
> "Syver Enstad" <syver.enstad at sensewave.com> wrote in message
> news:8u7dp0$vif$1 at troll.powertech.no...
>     [snip]
> > 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()
> 'ascii'
>
> as set by the default site.py.
>
>
> The corresponding locale.getdefaultlocale() situation:
>
> >>> import locale
> >>> locale.getdefaultlocale()
> ('en_US', 'cp1252')
>
> identically in all 3 environments, of course.
>
>
> Adding a sitecustomize.py to set the default encoding to
> the same as the default locale's codepage, i.e. here:
>
> import sys
> sys.setdefaultencoding('cp1252')
>
> or, also,
>
> sys.setdefaultencoding('iso-8859-1')
>
> 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...
>
>
> Alex
>
>
>





More information about the Python-list mailing list