[issue18814] Add codecs.convert_surrogateescape to "clean" surrogate escaped strings

Nick Coghlan report at bugs.python.org
Tue Sep 23 12:57:54 CEST 2014


Nick Coghlan added the comment:

The function definition again, this time with a draft docstring:

    def convert_surrogateescape(data, errors='replace'):
        """Convert escaped raw bytes by applying a different error handler

        Uses the "replace" error handler by default, but any input
        error handler may be specified.
        """
        return data.encode('utf-8', 'surrogateescape').decode('utf-8', errors)

----------

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


More information about the Python-bugs-list mailing list