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. :)
I think you can provide something like errors=combine_errors('surrogates', 'replace') as a library function, and it doesn't have to be part of the standard library.
The stacking argument also applies to the new utf8b behavior on encode (only, as it handles all errors on decode). This may be a YAGNI Indeed - in particular, as, in the primary application of this error handler (i.e. file IO operations), there is no way of specifying an addition error handler anyway.
Would it be useful to allow setting this somewhere?
I'm deliberately not proposing this as part of the PEP. First, it has enough features already, and is approved as-is; plus YAGNI. Regards, Martin