[issue7267] format method: c presentation type broken

Francisco Martín Brugué report at bugs.python.org
Sat Mar 23 21:52:57 CET 2013


Francisco Martín Brugué added the comment:

In 2.7.3 >>>

>>> u'{0:c}'.format(127)
u'\x7f'

>>> u'{0:c}'.format(128)

Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    u'{0:c}'.format(128)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)

>>> u'{0:c}'.format(255)

Traceback (most recent call last):
  File "<pyshell#7>", line 1, in <module>
    u'{0:c}'.format(255)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 0: ordinal not in range(128)

>>> u'{0:c}'.format(256)
u'\x00'

>>> u'{0:c}'.format(257)
u'\x01'

----------
nosy: +francismb

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


More information about the Python-bugs-list mailing list