[Python-Dev] unicode hell/mixing str and unicode as dictionary keys

Michael Urman murman at gmail.com
Fri Aug 4 06:45:05 CEST 2006


On 8/3/06, Josiah Carlson <jcarlson at uci.edu> wrote:
> As an alternate idea, rather than attempting to .decode('ascii') when
> strings and unicode compare, why not .decode('latin-1')?  We lose the
> unicode decoding error, but "the right thing" happens (in my opinion)
> when u'\xa1' and '\xa1' compare.

Since I use utf-8 way more than I use latin-1, -1. Since others do
not, -1 on any not obviously correct encoding other than ascii, which
gets grandfathered.

This raises an exception for a good reason. Yes it's annoying at
times. We should fix those times, not the (unbroken) exception.

Michael
-- 
Michael Urman  http://www.tortall.net/mu/blog


More information about the Python-Dev mailing list