aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/email/message.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-04-17 19:31:26 +0300
committerGitHub <noreply@github.com>2024-04-17 19:31:26 +0300
commitdeaecb88fa5da68cbffca413c63af95fd99578dd (patch)
tree6fd57f11e025d3fbb5fa4805e55af3b50befb84f /Lib/email/message.py
parentc179c0e6cbb4d1e981fffd43f207f5b1aa5388e5 (diff)
downloadcpython-deaecb88fa5da68cbffca413c63af95fd99578dd.tar.gz
cpython-deaecb88fa5da68cbffca413c63af95fd99578dd.zip
gh-80361: Fix TypeError in email.Message.get_payload() (GH-117994)
It was raised when the charset is rfc2231 encoded, e.g.: Content-Type: text/plain; charset*=ansi-x3.4-1968''utf-8
Diffstat (limited to 'Lib/email/message.py')
-rw-r--r--Lib/email/message.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/email/message.py b/Lib/email/message.py
index a14cca56b37..46bb8c21942 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: