[Python-Dev] Bytes path related questions for Guido

Glenn Linderman v+python at g.nevcal.com
Wed Aug 27 20:21:06 CEST 2014

On 8/26/2014 4:31 AM, MRAB wrote:
> On 2014-08-26 03:11, Stephen J. Turnbull wrote:
>> Nick Coghlan writes:
>>   > "purge_surrogate_escapes" was the other term that occurred to me.
>> "purge" suggests removal, not replacement.  That may be useful too.
>> neutralize_surrogate_escapes(s, remove=False, replacement='\uFFFD')
> How about:
>     replace_surrogate_escapes(s, replacement='\uFFFD')
> If you want them removed, just pass an empty string as the replacement.

And further, replacement could be a vector of 128 characters, to do 
immediate transcoding, or a single character to do wholesale replacement 
with some gibberish character, or None to remove (or an empty string).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140827/bfa142d1/attachment-0001.html>

More information about the Python-Dev mailing list