diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2024-03-05 17:49:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-05 17:49:01 +0200 |
commit | f97f25ef5dfcdfec0d9a359fd970abd139cf3428 (patch) | |
tree | 989a8a5b5c21dcff639abc58adadb9b512b73854 /Lib/email/message.py | |
parent | df594011089a83d151ac7000954665536f3461b5 (diff) | |
download | cpython-f97f25ef5dfcdfec0d9a359fd970abd139cf3428.tar.gz cpython-f97f25ef5dfcdfec0d9a359fd970abd139cf3428.zip |
gh-76511: Fix email.Message.as_string() for non-ASCII message with ASCII charset (GH-116125)
Diffstat (limited to 'Lib/email/message.py')
-rw-r--r-- | Lib/email/message.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/email/message.py b/Lib/email/message.py index fe769580fed..a14cca56b37 100644 --- a/Lib/email/message.py +++ b/Lib/email/message.py @@ -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: |