Issue 13209: Refactor code using unicode_encode_call_errorhandler() in unicodeobject.c (original) (raw)

It's difficult to use unicode_encode_call_errorhandler() because the caller has to:

It would be nice to factorize this code.

I plan this implement this refactoring, it's just a reminder for me :-)

I tried to factorize the code, but it is too complex. Each encoder handles errors differently. The most tricky is charmap: it reencodes the result of the error handler for non-ASCII characters. I'm not happy with the current situtation, but I don't see how to factorize easily the code, so I prefer to leave it unchanged. I close the issue.