summaryrefslogtreecommitdiffstats
path: root/Lib/email/message.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/email/message.py')
-rw-r--r--Lib/email/message.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/email/message.py b/Lib/email/message.py
index 3feab52..5020a03 100644
--- a/Lib/email/message.py
+++ b/Lib/email/message.py
@@ -275,6 +275,8 @@ class Message:
Optional charset sets the message's default character set. See
set_charset() for details.
"""
+ if isinstance(payload, bytes):
+ payload = payload.decode('ascii', 'surrogateescape')
self._payload = payload
if charset is not None:
self.set_charset(charset)