mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-76511: Fix email.Message.as_string() for non-ASCII message with ASCII charset (GH-116125)
This commit is contained in:
parent
df59401108
commit
f97f25ef5d
4 changed files with 21 additions and 2 deletions
|
@ -340,7 +340,7 @@ class Message:
|
|||
return
|
||||
if not isinstance(charset, Charset):
|
||||
charset = Charset(charset)
|
||||
payload = payload.encode(charset.output_charset)
|
||||
payload = payload.encode(charset.output_charset, 'surrogateescape')
|
||||
if hasattr(payload, 'decode'):
|
||||
self._payload = payload.decode('ascii', 'surrogateescape')
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue