acentuation problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mauricio Inforçati

    acentuation problem

    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´ve 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é"), it desn´t let me save the file, with this error.

    Exception in Tkinter callback
    Traceback (most recent call last):
    File "C:\Python22\li b\lib-tk\Tkinter.py", line 1316, in __call__
    return apply(self.func , args)
    File "C:\PYTHON22\To ols\idle\IOBind ing.py", line 128, in save
    if self.writefile( self.filename):
    File "C:\PYTHON22\To ols\idle\IOBind ing.py", line 151, in writefile
    chars = str(self.text.g et("1.0", "end-1c"))
    UnicodeError: ASCII encoding error: ordinal not in range(128)

    Similarly, on SHELL I can not use acentuation either.
    [shell][color=blue][color=green][color=darkred]
    >>> a = 'andré'[/color][/color][/color]
    UnicodeError: ASCII encoding error: ordinal not in range(128)[color=blue][color=green][color=darkred]
    >>> [/color][/color][/color]

    BUT, in a command line python, on the same OS, I can use acentuation normally, without using unicodes or escape characters.
    [command line]
    [color=blue][color=green][color=darkred]
    >>> a = 'andré'
    >>>[/color][/color][/color]

    Can anybody help me?

    Maurício Inforçati


  • Bengt Richter

    #2
    Re: acentuation problem

    On Tue, 12 Aug 2003 12:02:30 -0300, =?iso-8859-1?Q?Mauricio_In for=E7ati?= <mauricio.infor [email protected] .br> wrote:
    [color=blue]
    >This is a multi-part message in MIME format.
    >[/color]
    Please try to post only plain text to newsgroups.
    [...][color=blue]
    >
    >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\li b\lib-tk\Tkinter.py", line 1316, in __call__
    > return apply(self.func , args)
    > File "C:\PYTHON22\To ols\idle\IOBind ing.py", line 128, in save
    > if self.writefile( self.filename):
    > File "C:\PYTHON22\To ols\idle\IOBind ing.py", line 151, in writefile
    > chars =3D str(self.text.g et("1.0", "end-1c"))
    >UnicodeError : ASCII encoding error: ordinal not in range(128)
    >
    >Similarly, on SHELL I can not use acentuation either.
    >[shell][color=green][color=darkred]
    >>>> a =3D 'andr=E9'[/color][/color]
    >UnicodeError : ASCII encoding error: ordinal not in range(128)[color=green][color=darkred]
    >>>>=20[/color][/color]
    >
    >BUT, in a command line python, on the same OS, I can use acentuation =
    >normally, without using unicodes or escape characters.
    >[command line]
    >[color=green][color=darkred]
    >>>> a =3D 'andr=E9'
    >>>>[/color][/color]
    >
    >Can anybody help me?
    >[/color]
    Perhaps the encoding set in control panel>keyboard> input locales>propert ies 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\alia ses.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).
    [color=blue]
    > Maur=EDcio Infor=E7ati
    >
    >
    >------=_NextPart_000_ 01D4_01C360C9.9 B611630
    >Content-Type: text/html;
    > charset="iso-8859-1"[/color]
    [...please don't post html if you can avoid it...]

    Regards,
    Bengt Richter

    Comment

    Working...