New submission from Walter Dörwald <[email protected]>:
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'
----------
assignee: eric.smith
components: Interpreter Core
messages: 95114
nosy: doerwalter, eric.smith
severity: normal
status: open
title: Unicode arguments in str.format()
type: behavior
versions: Python 2.6
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue7300>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com