Skip to content

Commit

Permalink
Fixed #5778 -- Changed the way we detect if a string is non-ASCII whe…
Browse files Browse the repository at this point in the history
…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
malcolmt committed Oct 20, 2007
1 parent f34935c commit a0fdd7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions django/core/mail.py
Expand Up @@ -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 = []
Expand All @@ -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 = []
Expand Down

0 comments on commit a0fdd7c

Please sign in to comment.