acentuation problem

Bengt Richter bokr at oz.net
Tue Aug 12 15:24:26 EDT 2003


On Tue, 12 Aug 2003 12:02:30 -0300, =?iso-8859-1?Q?Mauricio_Infor=E7ati?= <mauricio.inforcati at cenpra.gov.br> wrote:

>This is a multi-part message in MIME format.
>
Please try to post only plain text to newsgroups.
[...]
>
>Hi,
>I am having problems with acentuation on python.
>Before, I used to have win98 with python 2.2.3. Everything worked =
>perfectly.
>Now, I=B4ve updated my OS to Windows 2000 and have problems.
>When I try to save on IDLE a script wich has portuguese acentuation on =
>some strings (like "andr=E9"), it desn=B4t let me save the file, with =
>this error.
>
>Exception in Tkinter callback
>Traceback (most recent call last):
>  File "C:\Python22\lib\lib-tk\Tkinter.py", line 1316, in __call__
>    return apply(self.func, args)
>  File "C:\PYTHON22\Tools\idle\IOBinding.py", line 128, in save
>    if self.writefile(self.filename):
>  File "C:\PYTHON22\Tools\idle\IOBinding.py", line 151, in writefile
>    chars =3D str(self.text.get("1.0", "end-1c"))
>UnicodeError: ASCII encoding error: ordinal not in range(128)
>
>Similarly, on SHELL I can not use acentuation either.
>[shell]
>>>> a =3D 'andr=E9'
>UnicodeError: ASCII encoding error: ordinal not in range(128)
>>>>=20
>
>BUT, in a command line python, on the same OS, I can use acentuation =
>normally, without using unicodes or escape characters.
>[command line]
>
>>>> a =3D 'andr=E9'
>>>>
>
>Can anybody help me?
>
Perhaps the encoding set in control panel>keyboard>input locales>properties is
not Portuguese?

The code page for the console window is separately (I believe) controlled with
the chcp command, which tells you the current code page number if you type chcp
without specifying anything.

Between that number and what you can see in your location for
D:\Python23\Lib\encodings\aliases.py, maybe you can figure out why one works
and the other doesn't.

Caveat: I haven't changed my control panel keyboard settings, so I don't know
if you have to reboot for it to take effect, or what else gets affected.

Martin Löwis is the guru on encodings (among other things).

>    Maur=EDcio Infor=E7ati
>
>
>------=_NextPart_000_01D4_01C360C9.9B611630
>Content-Type: text/html;
>	charset="iso-8859-1"
[...please don't post html if you can avoid it...]

Regards,
Bengt Richter




More information about the Python-list mailing list