mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
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
This commit is contained in:
parent
c179c0e6cb
commit
deaecb88fa
3 changed files with 18 additions and 1 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue