ascii problem

Skip Montanaro skip at pobox.com
Mon Aug 11 15:55:01 EDT 2003


    Mauricio> Why didn´t I have problems like this on Win98 and now I have
    Mauricio> it on Windows 2000? Its the same python (2.2) In my scripts,
    Mauricio> will I always have to do this process to add strings with
    Mauricio> portuguese acentuation?

Dunno.  I'm not a Windows person.  Maybe the default encoding changed.
Check your site.py file (probably in c:\Python22\site.py).  Read the code
which begins "# On Windows, some default encodings..." carefully.

Skip

    Mauricio> thanks,

    Mauricio>    Mauricio

    Mauricio> ----- Original Message -----
    Mauricio> From: "Skip Montanaro" <skip at pobox.com>
    Mauricio> To: "Mauricio Inforçati" <mauricio.inforcati at cenpra.gov.br>
    Mauricio> Cc: <python-list at python.org>
    Mauricio> Sent: Monday, August 11, 2003 4:20 PM
    Mauricio> Subject: Re: ascii problem


    >> 
    >> >>> a = "andré"
    >> UnicodeError: ASCII encoding error: ordinal not in range(128)
    >> 
    >> Use Unicode:
    >> 
    >> >>> a = unicode("andr\xe9", "iso-8859-1")
    >> >>> print a.encode("iso-8859-1")
    >> andré
    >> 
    >> With a Euro keyboard you won't have to embed hex codes in your strings.
    >> 
    >> Skip
    >> 
    >> 






More information about the Python-list mailing list