[New-bugs-announce] [issue22016] Add a new 'surrogatereplace' output only error handler

Nick Coghlan report at bugs.python.org
Sun Jul 20 13:19:14 CEST 2014


New submission from Nick Coghlan:

This would be along the same lines as xmlcharrefreplace and backslashreplace, but only affect surrogate escaped characters.

Unlike surrogate escape, which reproduces the escaped characters directly in the data stream, this would follow the 'replace' error handler and insert an appropriately encoded '?' character in the output stream.

The use case would be any context where losing the escaped characters is preferred to either potentially injecting arbitrary binary data into the output (surrogateescape), failing with an exception (strict), or any of the other existing codecs.

It would differ from 'replace' in that normal code points that can't be encoded at all would still trigger an error.

----------
components: Interpreter Core, Library (Lib)
messages: 223508
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Add a new 'surrogatereplace' output only error handler
versions: Python 3.5

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


More information about the New-bugs-announce mailing list