1#!/bin/sh 2###################################################### 3# 4# Test compatibility with RFC 6532, Internationalized 5# Email Headers 6# 7###################################################### 8 9set -e 10 11if test -z "${MH_OBJ_DIR}"; then 12 srcdir=`dirname $0`/../.. 13 MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR 14fi 15 16. "${MH_OBJ_DIR}/test/common.sh" 17 18setup_test 19mhl="${MH_LIBEXEC_DIR}/mhl" 20 21#### Make sure that html-to-text conversion is what we expect. 22require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 en_US.utf8 23 24 25start_test 'UTF-8 headers' 26#### The -- position the multibyte characters to check edge 27#### cases in the 'UTF-8 headers with narrow width' test below. 28cat >`mhpath new` <<EOF 29From: sender--ø@example.com 30To: recipientæ@example.com 31To: recipient2@example.com 32Cc: recip--æ@example.com 33Subject: Blåbærsyltetøy 34Date: 20 May 2014 14:28:51 +0200 35MIME-Version: 1.0 36Content-Type: text/plain; charset="UTF-8" 37Content-Transfer-Encoding: 8bit 38 39Blåbærsyltetøy er veldig godt. Jeg liker blåbærsyltetøy. 40Jøran. 41 42Text source: 43Arnt Gulbrandsen and Jiankang Yao, "Email Address Internationalization", 44Computing Edge 1:6, June 2015, 45http://www.computer.org/cms/computing-edge/ce-jun15-final.pdf, p. 50. 46EOF 47 48#### Just check that the (UTF-8) headers are displayed unscathed. run_test 49#### squashes the trailing blank lines from mhl. 50run_test "$mhl -form mhl.headers `mhpath last`" \ 51'Date: 20 May 2014 14:28:51 +0200 52To: recipientæ@example.com, 53 recipient2@example.com 54cc: recip--æ@example.com 55From: sender--ø@example.com 56Subject: Blåbærsyltetøy 57 58MIME-Version: 1.0' 59 60 61start_test 'UTF-8 headers with narrow width' 62run_test "$mhl -form mhl.headers -width 18 `mhpath last`" \ 63'Date: 20 May 2 64 ***014 14:28 65 ***:51 +0200 66To: recipien 67 ***tæ@exampl 68 ***e.com, 69 recipien 70 ***t2@exampl 71 ***e.com 72cc: recip--æ 73 ***@example. 74 ***com 75From: sender-- 76 ***ø@example 77 ***.com 78Subject: Blåbærsy 79 ***ltetøy 80 81MIME-Version: 1.0' 82 83 84start_test 'incompatible locale' 85# Show that LC_CTYPE is sufficient, if LC_ALL is unset. 86unset LC_ALL 87LC_CTYPE=C; export LC_CTYPE 88cat >"$MH_TEST_DIR/test.format" <<EOF 89; Doesn't decode From: or Subject:, to be really sure 90; that character replacement works. 91overflowtext="***",overflowoffset=5 92leftadjust,compwidth=9 93Date:formatfield="%<(nodate{text})%{text}%|%(pretty{text})%>" 94To: 95cc: 96From: 97Subject: 98EOF 99 100run_test "$mhl -form "$MH_TEST_DIR/test.format" `mhpath last`" \ 101'Date: 20 May 2014 14:28:51 +0200 102To: recipient??@example.com, 103 recipient2@example.com 104cc: recip--??@example.com 105From: sender--??@example.com 106Subject: Bl??b??rsyltet??y' 107rm -f "$MH_TEST_DIR/test.format" 108 109 110finish_test 111exit $failed 112