[Python-bugs-list] [ python-Bugs-438164 ] Format operator % fails with unicode
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 16 Aug 2001 03:47:53 -0700
Bugs item #438164, was opened at 2001-07-03 00:58
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=438164&group_id=5470
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Chema Cortés (chemacortes)
Assigned to: M.-A. Lemburg (lemburg)
Summary: Format operator % fails with unicode
Initial Comment:
A dictionary with unicode keys raise an error when it
is applied to a string throught the format operator %.
Here is the ofending code:
>>> "%(año)d" % { u"año":2001 } # KeyError: año
This fails because u"año" and "año" cannot be
compared: byte strings and Unicode strings are
comparable only if the byte string is ASCII.
> >>> u"%(año)4d" % { u"año":2001 } # KeyError: año
This fails because the key is converted to UTF-8
before lookup.
Must be add the unicode case into the format operator %
----------------------------------------------------------------------
>Comment By: M.-A. Lemburg (lemburg)
Date: 2001-08-16 03:47
Message:
Logged In: YES
user_id=38388
I'll look into this after I'm back from vacation on the 10.09.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=438164&group_id=5470