[Python-Dev] decoding errors when comparing strings
Fredrik Lundh
Fredrik Lundh" <effbot@telia.com
Sat, 15 Jul 2000 16:09:25 +0200
with the locale aware encoding mechanisms switched off
(sys.getdefaultencoding() =3D=3D "ascii"), I stumbled upon some
interesting behaviour:
first something that makes sense:
>>> u"abc" =3D=3D "abc"
1
>>> u"=E5=E4=F6" =3D=3D "abc"
0
but how about this one:
>>> u"abc" =3D=3D "=E5=E4=F6"
Traceback (most recent call last):
File "<stdin>", line 1, in ?
UnicodeError: ASCII decoding error: ordinal not in range(128)
or this one:
>>> u"=E5=E4=F6" =3D=3D "=E5=E4=F6"
Traceback (most recent call last):
File "<stdin>", line 1, in ?
UnicodeError: ASCII decoding error: ordinal not in range(128)
ignoring implementation details for a moment, is this really the
best we can do?
</F>