Message378088
I work around it with
```
class Message(email.message.Message):
def as_string(self):
# Work around for https://bugs.python.org/issue27321 and
# https://bugs.python.org/issue32330.
try:
value = email.message.Message.as_string(self)
except (KeyError, LookupError, UnicodeEncodeError):
value = email.message.Message.as_bytes(self).decode(
'ascii', 'replace')
# Also ensure no unicode surrogates in the returned string.
return email.utils._sanitize(value)
```
This is easy for me because it's Mailman which already subclasses email.message.Message for other reasons. It is perhaps more difficult if you aren't already subclassing email.message.Message for other purposes. |
|
Date |
User |
Action |
Args |
2020-10-06 02:54:38 | msapiro | set | recipients:
+ msapiro, barry, diekhans, r.david.murray, maciej.szulik, matrixise, cheryl.sabella, Johannes Löthberg, edeca |
2020-10-06 02:54:38 | msapiro | set | messageid: <1601952878.37.0.95144188272.issue27321@roundup.psfhosted.org> |
2020-10-06 02:54:38 | msapiro | link | issue27321 messages |
2020-10-06 02:54:38 | msapiro | create | |
|