From 8b3d659692b6d092991dc3b5b4042547f885fa8c Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Thu, 30 Aug 2007 02:10:49 +0000 Subject: Fix a more bytes/str confusion. Use str.encode('raw-unicode-escape') consistently instead of bytes(string). Remove the convert_eols argument from base64mime.decode(). This matches previous API changes done to the quoprimime module. --- Lib/email/message.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Lib/email/message.py') diff --git a/Lib/email/message.py b/Lib/email/message.py index 539af90a78..ad795f939d 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 -- cgit v1.2.1