]> git.ozlabs.org Git - patchwork/commit
parsemail: Fallback to common charsets when charset is None or x-unknown
authorSiddhesh Poyarekar <siddhesh@redhat.com>
Mon, 14 Jul 2014 02:21:32 +0000 (10:21 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 24 Jul 2014 09:30:45 +0000 (17:30 +0800)
commit880fc52d2d4ccdcbf4a7b76f1b4ba6b9e7482dff
tree993827678013aab90cccf4b032e956181dcef5aa
parentf49c72da5545f2da49dd83d9ec54fe232cf60360
parsemail: Fallback to common charsets when charset is None or x-unknown

We recently encountered a case in our glibc patchwork instance on
sourceware, where a patch was dropped because it had x-unknown
charset.

This change adds a fallback on a set of encodings (instead of just
utf-8) when the charset is not mentioned or if it is set as x-unknown.

Minor changes and testcase by Jeremy Kerr <jk@ozlabs.org>

Signed-off-by: Siddhesh Poyarekar <siddhesh@redhat.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
apps/patchwork/bin/parsemail.py
apps/patchwork/tests/mail/0010-invalid-charset.mbox [new file with mode: 0644]
apps/patchwork/tests/test_patchparser.py