[issue7649] "u'%c' % char" broken for chars in range '\x80'-'\xFF'

Marc-Andre Lemburg report at bugs.python.org
Wed Feb 24 11:50:16 CET 2010


Marc-Andre Lemburg <mal at egenix.com> added the comment:

Amaury Forgeot d'Arc wrote:
> 
> Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:
> 
>>> But why is it necessary to check for chars above 0x7f?
>> The Python default encoding has to be ASCII compatible,
> Yes, but it is not necessarily as strict.
> for example, after I manage to set the default encoding to latin-1,
> u"%s" % chr(0x80) works; I suppose %c should do the same.

Right and it will.

I only meant the check as fast-path for characters <0x80. All
other characters would need to go through PyUnicode_Decode().

We can use such a fast-path, since the default encoding has to
be ASCII compatible.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7649>
_______________________________________


More information about the Python-bugs-list mailing list