From 1777e74d2a53f2b36a3106563c629f85133fbace Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sat, 11 Aug 2007 12:10:07 +0000 Subject: [PATCH] Fixed #4910 -- Allow Unicode content to be passed in for text-based e-mail attachments. Thanks, djoume@taket.org. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5854 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/mail.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django/core/mail.py b/django/core/mail.py index 325812a5d2..ff653400f9 100644 --- a/django/core/mail.py +++ b/django/core/mail.py @@ -287,7 +287,8 @@ class EmailMessage(object): mimetype = DEFAULT_ATTACHMENT_MIME_TYPE basetype, subtype = mimetype.split('/', 1) if basetype == 'text': - attachment = SafeMIMEText(content, subtype, settings.DEFAULT_CHARSET) + attachment = SafeMIMEText(smart_str(content, + settings.DEFAULT_CHARSET), subtype, settings.DEFAULT_CHARSET) else: # Encode non-text attachments with base64. attachment = MIMEBase(basetype, subtype)