Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 authored October 20, 2007

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  django/core/mail.py
4  django/core/mail.py
@@ -73,7 +73,7 @@ def __setitem__(self, name, val):
73 73
         if '\n' in val or '\r' in val:
74 74
             raise BadHeaderError, "Header values can't contain newlines (got %r for header %r)" % (val, name)
75 75
         try:
76  
-            val = str(force_unicode(val))
  76
+            val = force_unicode(val).encode('ascii')
77 77
         except UnicodeEncodeError:
78 78
             if name.lower() in ('to', 'from', 'cc'):
79 79
                 result = []
@@ -92,7 +92,7 @@ def __setitem__(self, name, val):
92 92
         if '\n' in val or '\r' in val:
93 93
             raise BadHeaderError, "Header values can't contain newlines (got %r for header %r)" % (val, name)
94 94
         try:
95  
-            val = str(force_unicode(val))
  95
+            val = force_unicode(val).encode('ascii')
96 96
         except UnicodeEncodeError:
97 97
             if name.lower() in ('to', 'from', 'cc'):
98 98
                 result = []

0 notes on commit a0fdd7c

Please sign in to comment.
Something went wrong with that request. Please try again.