This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients ekontsevoy, eric.smith, r.david.murray
Date 2012-06-20.01:49:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1340156954.66.0.665582360521.issue15109@psf.upfronthosting.co.za>
In-reply-to
Content
>>> print('{}'.format(u'\u2107'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2107' in position 0: ordinal not in range(128)
>>> print('%s' % u'\u2107')
ℇ

(You get the exception without the print as well, just in case that isn't clear.)

Ah, and now I see why this is true.  The '%s' gets implicitly coerced to unicode.  So, it is not a bug in format, and the yield statement change should be reverted.

You can use format if you just always make your format input strings unicode strings (which you should be doing anyway, especially now that python3.3 will allow the 'u' prefix...that is, such code will be forward-compatible with Python3).
History
Date User Action Args
2012-06-20 01:49:14r.david.murraysetrecipients: + r.david.murray, eric.smith, ekontsevoy
2012-06-20 01:49:14r.david.murraysetmessageid: <1340156954.66.0.665582360521.issue15109@psf.upfronthosting.co.za>
2012-06-20 01:49:14r.david.murraylinkissue15109 messages
2012-06-20 01:49:13r.david.murraycreate