mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
bpo-43323: Fix UnicodeEncodeError in the email module (GH-32137)
It was raised if the charset itself contains characters not encodable
in UTF-8 (in particular \udcxx characters representing non-decodable
bytes in the source).
(cherry picked from commit e91dee87ed)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
869a894338
commit
3d0a5f73f5
6 changed files with 36 additions and 6 deletions
|
|
@ -781,7 +781,7 @@ def params(self):
|
|||
else:
|
||||
try:
|
||||
value = value.decode(charset, 'surrogateescape')
|
||||
except LookupError:
|
||||
except (LookupError, UnicodeEncodeError):
|
||||
# XXX: there should really be a custom defect for
|
||||
# unknown character set to make it easy to find,
|
||||
# because otherwise unknown charset is a silent
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue