Georg Brandl added the comment:
Agreed with Eric.
--
nosy: +georg.brandl
resolution: - wont fix
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7300
___
Pedro Algarvio added the comment:
This is not a 2.7 issue only:
import sys
sys.version_info
(2, 6, 5, 'final', 0
'Foo {0}'.format(u'bár')
Traceback (most recent call last):
File stdin, line 1, in module
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 1:
Ezio Melotti added the comment:
2.6 only gets security fixes.
My patch converts the format string to unicode using the default
encoding. It's inconsistent with str%args: str%args converts str to
unicode using the ASCII charset (if a least one argument is an unicode
string), not the
STINNER Victor added the comment:
Another option is to decide that this issue will *not* be fixed in Python 2,
and Python 3 *is* the good solution if you have this issue.
Doing the work twice can cause new problems, formatting an argument twice may
return two different values :-( It may have
Eric V. Smith added the comment:
I agree that we should close this as won't fix in 2.7.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7300
___
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
nosy: +chris.jerdonek
versions: -Python 2.6
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7300
___
Changes by Gökçen Eraslan gok...@pardus.org.tr:
--
nosy: +Gökçen.Eraslan
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7300
___
___
Changes by Florent Xicluna florent.xicl...@gmail.com:
--
nosy: +flox
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7300
___
___
Python-bugs-list
Eric Smith e...@trueblade.com added the comment:
I'm not sure I'm wild about doing the work twice, once as string and once as
unicode if need be. But I'll consider it, especially since this is only a 2.7
issue.
There could be side effects of evaluating the replacement strings, but I'm not
STINNER Victor victor.stin...@haypocalc.com added the comment:
PyString_Format() uses a goto unicode; if a '%c' or '%s' argument is unicode.
The unicode label converts the partial formatted result (byte string) to
unicode, and use PyUnicode_Format() to finish to formatting.
I don't think that
STINNER Victor victor.stin...@haypocalc.com added the comment:
*Draft* patch fixing the issue: render_field() raises an error if the argument
is an unicode argument, string_format() catchs this error and converts self to
unicode and call unicode.format(*args, **kw).
Pseudo-code:
try:
#
STINNER Victor victor.stin...@haypocalc.com added the comment:
My patch converts the format string to unicode using the default encoding. It's
inconsistent with str%args: str%args converts str to unicode using the ASCII
charset (if a least one argument is an unicode string), not the default
Changes by STINNER Victor victor.stin...@haypocalc.com:
--
nosy: +haypo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7300
___
___
Changes by Pablo Mouzo pablomo...@gmail.com:
--
nosy: +pablomouzo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7300
___
___
Python-bugs-list
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
nosy: +ezio.melotti
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7300
___
___
Python-bugs-list
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
priority: - high
stage: - test needed
versions: +Python 2.7
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7300
___
New submission from Walter Dörwald wal...@livinglogic.de:
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')
17 matches
Mail list logo