R. David Murray added the comment:

The email package uses surrogateescape to store unknown bytes in unicode 
strings, just as with the handle-bad-data-from-os API surrogateescape was 
introduced for.  (For the same reason: the source data may have improperly 
encoded bytes that we must nevertheless preserve).  What action certain parts 
of the code takes differs depending on whether or not there are such encoded 
bytes in the string.  So the code needs to check and branch based on that.

The utility function is email.utils._has_surrogates.  You can grep the email 
source to see where it is used, if you like.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18814>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to