I'm not sure if this was a user error or a Git send-email error, but
notmuch has a message with:
Subject: =?no?q?=5BPATCH=203/3=5D=20Add=20=27compose=27=20command?=
...
Message-Id: <
1291933972-7186-4-git-send-email-felipe.contreras@gmail.com>
X-Mailer: git-send-email 1.7.3.2
Without this patch, that raises:
LookupError: unknown encoding: no
'Keld Jørn Simonsen'
>>> _decode_header(string='Keld =?ISO-8859-1?Q?J=F8rn_Simonsen?=')
'Keld Jørn Simonsen'
+
+ We also support a few non-standard cases for compatibility with
+ existing messages:
+
+ >>> _decode_header(string='=?no?q?=5BPATCH=203/3=5D=20Add=20=27compose=27=20command?=')
+ "[PATCH 3/3] Add 'compose' command"
"""
chunks = []
for decoded, charset in _email_header.decode_header(string):
if isinstance(decoded, bytes) and not charset:
charset = 'ASCII'
if charset:
+ if charset in ['no']:
+ charset = 'ASCII'
decoded = str(decoded, charset)
chunks.append(decoded)
return ''.join(chunks)