]>
diplodocus.org Git - nmh/blob - test/mhshow/test-charset
2 ######################################################
4 # Test charset conversion functionality
6 ######################################################
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir
=`dirname "$0"`/..
/..
12 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
15 .
"$MH_OBJ_DIR/test/common.sh"
19 check_exit
'-eq 1' mhshow
-
21 require_locale en_US.UTF
-8 en_US.UTF8 en_US.utf
-8 en_US.utf8
23 test "$ICONV_ENABLED" -eq 0 && text_size
=10 || text_size
=11
25 expected
=$MH_TEST_DIR/$$.expected
26 actual
=$MH_TEST_DIR/$$.actual
28 echo 'mhshow-charset-windows-1252: echo "This is a test"' >> "$MH"
30 # Write message with bogus quoted-printable data.
31 start_test
'Write message with bogus quoted-printable data'
33 msgnum
=`basename $msgfile`
39 Content-Type: text/plain; charset=windows-1252
40 Content-Transfer-Encoding: quoted-printable
41 Content-Description: bogus quoted-printable data
42 Date: Sun, 18 Dec 2005 00:52:39 +0100
49 Date: Sun, 18 Dec 2005 00:52:39 +0100
55 Content-Description: bogus quoted-printable data
57 [ part - text/plain - bogus quoted-printable data ${text_size}B ]
61 run_prog mhshow
$msgnum > $actual 2>&1
62 check
"$expected" "$actual" 'keep first' : bogus quoted
-printable data
65 start_test
'locale profile component'
66 #### Used LC_ALL above, now use locale profile component instead.
67 printf "locale: $LC_ALL\n" >> "${MH}"
70 run_prog mhshow
$msgnum > $actual 2>&1
71 check
"$expected" "$actual" : locale profile component
74 start_test
'Encoded parameter value'
76 msgnum
=`basename $msgfile`
77 #### The encoded charset name is really UTF-8 encoded,
78 #### but say it's UTF-16 to exercise the iconv code,
79 #### if it's available, in get_param_value().
85 Content-Type: text/plain; charset*=EBCDIC-US''%e4%e3%c6%60%f8
86 Content-Transfer-Encoding: quoted-printable
87 Content-Description: bogus quoted-printable data
88 Date: Sun, 18 Dec 2005 00:52:39 +0100
95 Date: Sun, 18 Dec 2005 00:52:39 +0100
101 Content-Description: bogus quoted-printable data
103 [ part - text/plain - bogus quoted-printable data 11B ]
107 if test "$ICONV_ENABLED" -eq 1; then
108 if iconv -l | grep EBCDIC
-US >/dev
/null
; then
109 #### For unknown reasons, this test fails on the FreeBSD10
110 #### buildbot. It doesn't support EBCDIC-US, so skip it
112 run_prog mhshow
$msgnum > $actual 2>&1
113 check
"$expected" "$actual" : encoded parameter value
118 start_test
'replacement character in parameter value'
119 #### The output of this test doesn't show it, but it covers the
120 #### noiconv: portion of get_param_value().
121 cat > $msgfile <<'EOF'
122 Subject: invalid parameter value charset
124 Content-Type: text/plain; charset*=invalid''%0Dus-ascii
127 cat > $expected <<EOF
129 Subject: invalid parameter value charset
133 [ part - text/plain - 0B ]
136 run_prog mhshow
$msgnum > $actual 2>&1
137 check
"$expected" "$actual"