diff options
Diffstat (limited to 'Lib/email/message.py')
-rw-r--r-- | Lib/email/message.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/email/message.py b/Lib/email/message.py index 539af90..ad795f9 100644 --- a/Lib/email/message.py +++ b/Lib/email/message.py @@ -201,7 +201,7 @@ class Message: # Incorrect padding pass elif cte in ('x-uuencode', 'uuencode', 'uue', 'x-uue'): - in_file = BytesIO(bytes(payload + '\n')) + in_file = BytesIO((payload + '\n').encode('raw-unicode-escape')) out_file = BytesIO() try: uu.decode(in_file, out_file, quiet=True) @@ -757,7 +757,8 @@ class Message: # LookupError will be raised if the charset isn't known to # Python. UnicodeError will be raised if the encoded text # contains a character not in the charset. - charset = str(bytes(charset[2]), pcharset) + as_bytes = charset[2].encode('raw-unicode-escape') + charset = str(as_bytes, pcharset) except (LookupError, UnicodeError): charset = charset[2] # charset characters must be in us-ascii range |