--- Lib\email\header.py.orig 2008-12-03 00:26:33.015625000 +0900 +++ Lib\email\header.py 2008-12-03 00:52:10.859375000 +0900 @@ -39,7 +39,7 @@ \? # literal ? (?P.*?) # non-greedy up to the next ?= is the encoded string \?= # literal ?= - (?=[ \t]|$) # whitespace or the end of the string + (?=[ \t]|\r\n|$) # whitespace or the end of the string ''', re.VERBOSE | re.IGNORECASE | re.MULTILINE) # Field name regexp, including trailing colon, but not separating whitespace, --- Lib\email\test\test_email.py.orig 2008-12-03 00:52:48.578125000 +0900 +++ Lib\email\test\test_email.py 2008-12-03 00:53:23.421875000 +0900 @@ -2938,6 +2938,11 @@ s = 'Subject: =?EUC-KR?B?CSixpLDtKSC/7Liuvsax4iC6uLmwMcijIKHaILzSwd/H0SC8+LCjwLsgv7W/+Mj3IQ?=' raises(Errors.HeaderParseError, decode_header, s) + def test_separete_crlf(self): + eq = self.assertEqual + s = '=?iso-8859-1?q?hello?=\r\n world.' + parts = decode_header(s) + eq(parts, [('hello', 'iso-8859-1'), (' world.', None)]) # Test RFC 2231 header parameters (en/de)coding