diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-03-05 17:27:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-05 17:27:22 (GMT) |
commit | 85c32ad9fd3780d8cc68a692c396cc840c093d69 (patch) | |
tree | a9709fc1404a1c3d60e517c6717d87cdb20e0056 /Lib/email/message.py | |
parent | 34efd49280ca710fd0358c72323c9d0c45a32b27 (diff) | |
download | cpython-85c32ad9fd3780d8cc68a692c396cc840c093d69.zip cpython-85c32ad9fd3780d8cc68a692c396cc840c093d69.tar.gz cpython-85c32ad9fd3780d8cc68a692c396cc840c093d69.tar.bz2 |
[3.12] gh-76511: Fix email.Message.as_string() for non-ASCII message with ASCII charset (GH-116125) (GH-116364)
(cherry picked from commit f97f25ef5dfcdfec0d9a359fd970abd139cf3428)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
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 fe76958..a14cca5 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: |