diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-04-17 16:59:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-17 16:59:35 (GMT) |
commit | fda8cd1fd38a12e17b1db1775d54ff0fa4d886b8 (patch) | |
tree | ba0127c7f89e042d76be05558b193aae3db7959f /Lib/email/message.py | |
parent | e95a535ea2915060759db66ae9e228a19f134125 (diff) | |
download | cpython-fda8cd1fd38a12e17b1db1775d54ff0fa4d886b8.zip cpython-fda8cd1fd38a12e17b1db1775d54ff0fa4d886b8.tar.gz cpython-fda8cd1fd38a12e17b1db1775d54ff0fa4d886b8.tar.bz2 |
[3.12] gh-80361: Fix TypeError in email.Message.get_payload() (GH-117994) (GH-117998)
It was raised when the charset is rfc2231 encoded, e.g.:
Content-Type: text/plain; charset*=ansi-x3.4-1968''utf-8
(cherry picked from commit deaecb88fa5da68cbffca413c63af95fd99578dd)
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 a14cca5..46bb8c2 100644 --- a/Lib/email/message.py +++ b/Lib/email/message.py @@ -294,7 +294,7 @@ class Message: try: bpayload = payload.encode('ascii', 'surrogateescape') try: - payload = bpayload.decode(self.get_param('charset', 'ascii'), 'replace') + payload = bpayload.decode(self.get_content_charset('ascii'), 'replace') except LookupError: payload = bpayload.decode('ascii', 'replace') except UnicodeEncodeError: |