ascii problem

Skip Montanaro skip at
Mon Aug 11 21:20:43 CEST 2003

    >>> 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")

With a Euro keyboard you won't have to embed hex codes in your strings.


More information about the Python-list mailing list