diff options
| author | Barry Warsaw | 2017-01-10 02:14:25 +0000 |
|---|---|---|
| committer | Barry Warsaw | 2017-01-10 02:14:25 +0000 |
| commit | 1ead61097429bca15a9eaf87246b98bb5e34b8d2 (patch) | |
| tree | 201e51fe460ab1079effd66d2a5e724dc701dc97 | |
| parent | 0403f0bfc77a94656db28b6dfd1b44bea2e13881 (diff) | |
| parent | 57eeb0b2f83a387516ecbfb1525299de3d0324ae (diff) | |
| download | mailman-1ead61097429bca15a9eaf87246b98bb5e34b8d2.tar.gz mailman-1ead61097429bca15a9eaf87246b98bb5e34b8d2.tar.zst mailman-1ead61097429bca15a9eaf87246b98bb5e34b8d2.zip | |
| -rw-r--r-- | src/mailman/handlers/cook_headers.py | 9 | ||||
| -rw-r--r-- | src/mailman/handlers/tests/test_cook_headers.py | 23 |
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. +""") |
