]> diplodocus.org Git - nmh/blobdiff - test/mhl/test-rfc6532
Fixed display of header field values with multibyte characters.
[nmh] / test / mhl / test-rfc6532
index fb9860446918eb5b31b70373da0649a10d18af5a..05dae7bc84483279a62d8cb9d4d1d1429671d09c 100755 (executable)
@@ -16,17 +16,20 @@ fi
 . "${MH_OBJ_DIR}/test/common.sh"
 
 setup_test
+mhl="${MH_LIBEXEC_DIR}/mhl"
 
 #### Make sure that html-to-text conversion is what we expect.
-require_locale en_US.utf-8 en_US.utf8
-LC_ALL=en_US.UTF-8; export LC_ALL
+require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 en_US.utf8
 
 
-# check UTF-8 headers
 start_test 'UTF-8 headers'
-cat >"$MH_TEST_DIR"/Mail/inbox/11 <<EOF
-From: receiverø@example.com
-To: senderæ@example.com
+#### The -- position the multibyte characters to check edge
+#### cases in the 'UTF-8 headers with narrow width' test below.
+cat >`mhpath new` <<EOF
+From: sender--ø@example.com
+To: recipientæ@example.com
+To: recipient2@example.com
+Cc: recip--æ@example.com
 Subject: Blåbærsyltetøy
 Date: 20 May 2014 14:28:51 +0200
 MIME-Version: 1.0
@@ -44,11 +47,53 @@ EOF
 
 #### Just check that the (UTF-8) headers are displayed unscathed.  run_test
 #### squashes the trailing blank lines from mhl.
-run_test "mhl -form mhl.headers `mhpath last`" \
+run_test "$mhl -form mhl.headers `mhpath last`" \
 'Date:    20 May 2014 14:28:51 +0200
-To:      senderæ@example.com
-From:    receiverø@example.com
-Subject: Blåbærsyltetøy'
+To:      recipientæ@example.com,
+        recipient2@example.com
+cc:      recip--æ@example.com
+From:    sender--ø@example.com
+Subject: Blåbærsyltetøy
+
+MIME-Version: 1.0'
+
+
+start_test 'UTF-8 headers with narrow width'
+run_test "$mhl -form mhl.headers -width 18 `mhpath last`" \
+'Date:    20 May 2
+     ***014 14:28
+     ***:51 +0200
+To:      recipien
+     ***tæ@exampl
+     ***e.com,
+        recipien
+     ***t2@exampl
+     ***e.com
+cc:      recip--æ
+     ***@example.
+     ***com
+From:    sender--
+     ***ø@example
+     ***.com
+Subject: Blåbærsy
+     ***ltetøy
+
+MIME-Version: 1.0'
+
+
+# check with incompatible locale
+# This is here as a place holder.  We should either try to run the (8-bit) text
+# through iconv, or refuse to display it if the locale is incompatible.  In the
+# case of EAI, that means not UTF-8.
+# start_test 'incompatible locale'
+# LC_ALL=C
+# run_test "$mhl -form mhl.headers `mhpath last`" \
+# 'Date:    20 May 2014 14:28:51 +0200
+# To:      recipientæ@example.com
+# From:    sender??@example.com
+# Subject: Bl??b??rsyltet??y
+#
+# MIME-Version: 1.0'
 
 
 finish_test