test: Add test for searching of uncommonly encoded messages
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 24 Feb 2012 00:33:15 +0000 (01:33 +0100)
committerDavid Bremner <bremner@debian.org>
Wed, 29 Feb 2012 11:34:54 +0000 (07:34 -0400)
Emails that are encoded differently than as ASCII or UTF-8 are not
indexed properly by notmuch. It is not possible to search for non-ASCII
words within those messages.

test/encoding
test/test-lib.sh

index 33259c1448fb8b0fc6b8943c2d9ceb1d81af661c..3992b5c1670640714b085c49730353b60674a068 100755 (executable)
@@ -21,4 +21,13 @@ irrelevant
 \fbody}
 \fmessage}"
 
+test_begin_subtest "Search for ISO-8859-2 encoded message"
+test_subtest_known_broken
+add_message '[content-type]="text/plain; charset=iso-8859-2"' \
+            '[content-transfer-encoding]=8bit' \
+            '[subject]="ISO-8859-2 encoded message"' \
+            "[body]=$'Czech word tu\350\362\341\350\350\355 means pinguin\'s.'" # ISO-8859-2 characters are generated by shell's escape sequences
+output=$(notmuch search tučňáččí 2>&1 | notmuch_show_sanitize)
+test_expect_equal "$output" "thread:0000000000000002   2001-01-05 [1/1] Notmuch Test Suite; ISO-8859-2 encoded message (inbox unread)"
+
 test_done
index 063a2b273049c18a9ba95cbede3348063a174d3b..278150677c4a92e8df4a723be693fae108213576 100644 (file)
@@ -356,6 +356,11 @@ ${additional_headers}"
 ${additional_headers}"
     fi
 
+    if [ ! -z "${template[content-transfer-encoding]}" ]; then
+       additional_headers="Content-Transfer-Encoding: ${template[content-transfer-encoding]}
+${additional_headers}"
+    fi
+
     # Note that in the way we're setting it above and using it below,
     # `additional_headers' will also serve as the header / body separator
     # (empty line in between).