]>
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 skip_param_value_checks
=0
24 if test "$ICONV_ENABLED" -eq 0; then
28 #### For unknown reasons, the parameter values checks fail on the
29 #### FreeBSD10 buildbot. It doesn't support EBCDIC-US, which is used
30 #### by the checks, so check for that. Though that doesn't seem to be
32 printf '\xe4' | iconv -f EBCDIC
-US -t UTF
-8 >/dev
/null
2>&1 ||
33 skip_param_value_checks
=1
36 expected
=$MH_TEST_DIR/$$.expected
37 actual
=$MH_TEST_DIR/$$.actual
39 echo 'mhshow-charset-windows-1252: echo "This is a test"' >> "$MH"
41 # Write message with bogus quoted-printable data.
42 start_test
'Write message with bogus quoted-printable data'
44 msgnum
=`basename $msgfile`
50 Content-Type: text/plain; charset=windows-1252
51 Content-Transfer-Encoding: quoted-printable
52 Content-Description: bogus quoted-printable data
53 Date: Sun, 18 Dec 2005 00:52:39 +0100
60 Date: Sun, 18 Dec 2005 00:52:39 +0100
66 Content-Description: bogus quoted-printable data
68 [ part - text/plain - bogus quoted-printable data ${text_size}B ]
72 run_prog mhshow
$msgnum > $actual 2>&1
73 check
"$expected" "$actual" 'keep first' : bogus quoted
-printable data
76 start_test
'locale profile component'
77 #### Used LC_ALL above, now use locale profile component instead.
78 printf "locale: $LC_ALL\n" >> "${MH}"
81 run_prog mhshow
$msgnum > $actual 2>&1
82 check
"$expected" "$actual" : locale profile component
85 if test $skip_param_value_checks -eq 1; then
91 start_test
'Encoded parameter value'
93 msgnum
=`basename $msgfile`
94 #### The encoded charset name is really UTF-8 encoded,
95 #### but say it's UTF-16 to exercise the iconv code,
96 #### if it's available, in get_param_value().
102 Content-Type: text/plain; charset*=EBCDIC-US''%e4%e3%c6%60%f8
103 Content-Transfer-Encoding: quoted-printable
104 Content-Description: bogus quoted-printable data
105 Date: Sun, 18 Dec 2005 00:52:39 +0100
110 cat > $expected <<EOF
112 Date: Sun, 18 Dec 2005 00:52:39 +0100
114 From: foo@example.edu
118 Content-Description: bogus quoted-printable data
120 [ part - text/plain - bogus quoted-printable data 11B ]
124 run_prog mhshow
$msgnum > $actual 2>&1
125 check
"$expected" "$actual" : encoded parameter value
128 start_test
'replacement character in parameter value'
129 #### The output of this test doesn't show it, but it covers the
130 #### noiconv: portion of get_param_value().
131 cat > $msgfile <<'EOF'
132 Subject: invalid parameter value charset
134 Content-Type: text/plain; charset*=invalid''%0Dus-ascii
137 cat > $expected <<EOF
139 Subject: invalid parameter value charset
143 [ part - text/plain - 0B ]
146 run_prog mhshow
$msgnum > $actual 2>&1
147 check
"$expected" "$actual"