diff options
-rw-r--r-- | alot/db/utils.py | 12 | ||||
-rw-r--r-- | tests/db/test_utils.py | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/alot/db/utils.py b/alot/db/utils.py index 94886148..75fc0178 100644 --- a/alot/db/utils.py +++ b/alot/db/utils.py @@ -526,15 +526,9 @@ def decode_header(header, normalize=False): :type normalize: bool :rtype: str """ - # some mailers send out incorrectly escaped headers - # and double quote the escaped realname part again. remove those - # RFC: 2047 - regex = r'"(=\?.+?\?.+?\?[^ ?]+\?=)"' - value = re.sub(regex, r'\1', header) - logging.debug("unquoted header: |%s|", value) - - # otherwise we interpret RFC2822 encoding escape sequences - valuelist = email.header.decode_header(value) + logging.debug("unquoted header: |%s|", header) + + valuelist = email.header.decode_header(header) decoded_list = [] for v, enc in valuelist: v = string_decode(v, enc) diff --git a/tests/db/test_utils.py b/tests/db/test_utils.py index f6249542..1e230aef 100644 --- a/tests/db/test_utils.py +++ b/tests/db/test_utils.py @@ -272,6 +272,12 @@ class TestDecodeHeader(unittest.TestCase): expected = u'first\nsecond third fourth fifth' actual = utils.decode_header(text, normalize=True) self.assertEqual(actual, expected) + + def test_exchange_quotes_remain(self): + # issue #1347 + expected = u'"Mouse, Michaƫl" <x@y.z>' + text = self._quote(expected, 'utf-8') + self._test(text, expected) class TestAddSignatureHeaders(unittest.TestCase): |