[issue15278] UnicodeDecodeError when readline in codecs.py

Serhiy Storchaka report at bugs.python.org
Tue Oct 9 23:34:22 CEST 2012


Serhiy Storchaka added the comment:

> This issue may be related or a duplicate of #11461.

Oh, yes, it is a duplicate. I totally forgot about it and made the work again.

> Only incremental decoder should return partial results. Other decoders are
> strict and (usually) stateless.

Yes, there is a incremental decoder.

> >>> decoder('\u20ac'.encode('utf8')[:2], 'strict')
> 
> UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 0-1:
> unexpected end of data

>>> codecs.utf_8_decode('\u20ac'.encode('utf8')[:2])
('', 0)

----------

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


More information about the Python-bugs-list mailing list