[Python-Dev] PEP 383 update: utf8b is now the error handler
Walter Dörwald
walter at livinglogic.de
Thu May 7 16:33:21 CEST 2009
Michael Urman wrote:
> [...]
>> Well, there is a way to stack error handlers, although it's not pretty:
>> [...]
>> codecs.register_error("surrogates_then_replace",
>> surrogates_then_replace)
>
> That mitigates my arguments significantly, although I'd rather see
> something like errors=('surrogates', 'replace') chain the handlers
> without additional registrations. But that's a different PEP or
> arbitrary change. :)
The first version of PEP 293 changed the errors argument to be a string
or callable. This would have simplified handler stacking somewhat
(because you don't have to register or lookup handlers) but it had the
disadvantage that many "char *" arguments in the C API would have had to
changed to "PyObject *". Changing the errors argument to a list of
strings would have the same problem.
Servus,
Walter
More information about the Python-Dev
mailing list