ASCII encoding error: ordinal not in range(128)

Tim Peters tim.one at home.com
Tue Mar 20 22:18:25 EST 2001


[Fredrik Lundh]
>> UnicodeError: ASCII encoding error: ordinal not in range(128)
>
> translated to english, this overly cute error message attempts
> to say something like "cannot convert this Unicode string to
> ASCII as it contains non-ASCII characters"

[Andrew Kuchling]
> Hmm... hasn't changing this message before been discussed someplace?

Yes, /F griped about this on Python-Dev, Sat, 26 Aug 2000 17:43:38 +0200, and
suggested

    ASCII decoding error: character not in range 0-127

instead.  I counter-proposed

    ASCII decoding error: ord(character) > 127

since characters aren't integers in Python.  AFAICT, that's the grand total
of the debate.

> Was there some reason it wasn't changed?

None apparent.

> How about: "UnicodeError:  ASCII encoding error: character not in
> ASCII range 0-127" ?  (I vaguely recall Marc-Andre arguing for
> "ordinal", since that's used in the Unicode documents, but if it's
> less clear...)

Anything is better than what it says now!

even-a-ham-sandwich-ly y'rs  - tim





More information about the Python-list mailing list