Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #5778 -- Changed the way we detect if a string is non-ASCII whe…

…n creating

email headers. This fixes a problem that was showing up on some (but not all)
systems.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6551 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a0fdd7c7dd263cc0718d0e54597f9da414fd775c 1 parent f34935c
Malcolm Tredinnick malcolmt authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 django/core/mail.py
4 django/core/mail.py
View
@@ -73,7 +73,7 @@ def __setitem__(self, name, val):
if '\n' in val or '\r' in val:
raise BadHeaderError, "Header values can't contain newlines (got %r for header %r)" % (val, name)
try:
- val = str(force_unicode(val))
+ val = force_unicode(val).encode('ascii')
except UnicodeEncodeError:
if name.lower() in ('to', 'from', 'cc'):
result = []
@@ -92,7 +92,7 @@ def __setitem__(self, name, val):
if '\n' in val or '\r' in val:
raise BadHeaderError, "Header values can't contain newlines (got %r for header %r)" % (val, name)
try:
- val = str(force_unicode(val))
+ val = force_unicode(val).encode('ascii')
except UnicodeEncodeError:
if name.lower() in ('to', 'from', 'cc'):
result = []
Please sign in to comment.
Something went wrong with that request. Please try again.