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

James Y Knight foom at fuhm.net
Fri Aug 4 06:39:29 CEST 2006


On Aug 4, 2006, at 12:34 AM, Josiah Carlson 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.

Maybe you want those to compare equal, but _I_ want u'\xa1' and '\xc2 
\xa1' to compare equal, so it should obviously use .decode('utf-8')!

(okay, no, I don't really want that.)

James


More information about the Python-Dev mailing list