Author doerwalter
Recipients doerwalter, eric.smith
Date 2009-11-10.13:57:33
SpamBayes Score 5.62012e-12
Marked as misclassified No
Message-id <1257861455.06.0.0846130484851.issue7300@psf.upfronthosting.co.za>
In-reply-to
Content
str.format() doesn't handle unicode arguments:

Python 2.6.4 (r264:75706, Oct 27 2009, 15:18:04) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> '{0}'.format(u'\u3042')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in
position 0: ordinal not in range(128)

Unicode arguments should be treated in the same way as the % operator
does it: by promoting the format string to unicode:

>>> '%s' % u'\u3042'
u'\u3042'
History
Date User Action Args
2009-11-10 13:57:35doerwaltersetrecipients: + doerwalter, eric.smith
2009-11-10 13:57:35doerwaltersetmessageid: <1257861455.06.0.0846130484851.issue7300@psf.upfronthosting.co.za>
2009-11-10 13:57:33doerwalterlinkissue7300 messages
2009-11-10 13:57:33doerwaltercreate