[issue28774] Better start and end position for unicodeerror in unicode_encode_ucs1

STINNER Victor report at bugs.python.org
Tue Nov 22 10:01:00 EST 2016


STINNER Victor added the comment:

If I understood correctly, the patch fix the ASCII encoder to handle correctly error handlers which return non-ASCII text replacement strings. Right?

I am not aware of such error handler, so I guess that it's a more a theorical fix?

I really hate the code (in each encoder) which handles non-ASCII replacement strings. The code in the charmap encoder is just a mess: it uses a reentrant call to the encoder... I never understood this crazy behaviour. I guess that nobody relies on the behaviour. I hesitate to simply raise an error instead of using different rules depending on the code. Ah yes, by the way, each codec behaves differently on non-ASCII replacement strings...

----------

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


More information about the Python-bugs-list mailing list