summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mailman/handlers/cook_headers.py9
-rw-r--r--src/mailman/handlers/tests/test_cook_headers.py23
2 files changed, 23 insertions, 9 deletions
diff --git a/src/mailman/handlers/cook_headers.py b/src/mailman/handlers/cook_headers.py
index c7bb118aa..c3beb362e 100644
--- a/src/mailman/handlers/cook_headers.py
+++ b/src/mailman/handlers/cook_headers.py
@@ -17,7 +17,6 @@
"""Cook a message's headers."""
-import re
import logging
from email.header import Header
@@ -34,7 +33,6 @@ log = logging.getLogger('mailman.error')
COMMASPACE = ', '
MAXLINELEN = 78
-NONASCII = re.compile('[^\s!-~]')
@public
@@ -49,13 +47,6 @@ def uheader(mlist, s, header_name=None, continuation_ws='\t', maxlinelen=None):
If the header contains a newline, truncate it (see GL#273).
"""
charset = mlist.preferred_language.charset
- if NONASCII.search(s):
- # use list charset but ...
- if charset == 'us-ascii':
- charset = 'iso-8859-1'
- else:
- # there is no non-ascii so ...
- charset = 'us-ascii'
if '\n' in s:
s = '{} [...]'.format(s.split('\n')[0])
log.warning('Header {} contains a newline, truncating it.'.format(
diff --git a/src/mailman/handlers/tests/test_cook_headers.py b/src/mailman/handlers/tests/test_cook_headers.py
index 67a8243b2..68bde9a2f 100644
--- a/src/mailman/handlers/tests/test_cook_headers.py
+++ b/src/mailman/handlers/tests/test_cook_headers.py
@@ -86,3 +86,26 @@ Reply-To: "A multiline [...]" <ant@example.com>
More things to say.
""")
+
+ def test_non_ascii_description(self):
+ self._mlist.description = 'Some Coffee \u2615'
+ self._mlist.reply_goes_to_list = ReplyToMunging.point_to_list
+ msg = mfs("""\
+From: anne@example.com
+To: ant@example.com
+Subject: A subject
+X-Mailman-Version: X.Y
+
+More things to say.
+""")
+ cook_headers.process(self._mlist, msg, {})
+ self.assertMultiLineEqual(msg.as_string(), """\
+From: anne@example.com
+To: ant@example.com
+Subject: A subject
+X-Mailman-Version: X.Y
+Precedence: list
+Reply-To: =?utf-8?b?U29tZSBDb2ZmZWUg4piV?= <ant@example.com>
+
+More things to say.
+""")