I'm not sure if this was a user error or a Git send-email error, but
notmuch has a message with:
Subject: =?\x10\x10?q?=5BPATCH=20v7=203/3=5D=20Use=20the=20structured=20formatters=20in=20notmuch-search=2Ec=2E?=
...
Message-Id: <
1342766173-1344-4-git-send-email-craven@gmx.net>
X-Mailer: git-send-email 1.7.11.2
Without this patch, that raises:
LookupError: unknown encoding:
_COMMIT_MESSAGE_ENCODING = 'UTF-8'
_FOLDING_WHITESPACE_REGEX = _re.compile('\s*\n\s*')
+_FALLBACK_ENCODINGS = { # support non-standard RFC 2047 encodings
+ 'no': 'ASCII',
+ '\x10\x10': 'ASCII',
+ }
class DirtyIndex(RuntimeError):
if isinstance(decoded, bytes) and not charset:
charset = 'ASCII'
if charset:
- if charset in ['no']:
- charset = 'ASCII'
+ if charset in _FALLBACK_ENCODINGS:
+ charset = _FALLBACK_ENCODINGS[charset]
decoded = str(decoded, charset)
chunks.append(decoded)
return ''.join(chunks)