
report at bugs
Nov 10, 2009, 5:57 AM
Post #1 of 2
(187 views)
Permalink
|
|
[issue7300] Unicode arguments in str.format()
|
|
New submission from Walter Dörwald <walter [at] livinglogic>: 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 <report [at] bugs> <http://bugs.python.org/issue7300> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
|