]>
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 start_test
'Encoded parameter value'
87 msgnum
=`basename $msgfile`
88 #### The encoded charset name is really UTF-8 encoded,
89 #### but say it's UTF-16 to exercise the iconv code,
90 #### if it's available, in get_param_value().
96 Content-Type: text/plain; charset*=EBCDIC-US''%e4%e3%c6%60%f8
97 Content-Transfer-Encoding: quoted-printable
98 Content-Description: bogus quoted-printable data
99 Date: Sun, 18 Dec 2005 00:52:39 +0100
104 cat > $expected <<EOF
106 Date: Sun, 18 Dec 2005 00:52:39 +0100
108 From: foo@example.edu
112 Content-Description: bogus quoted-printable data
114 [ part - text/plain - bogus quoted-printable data 11B ]
118 if test $skip_param_value_checks -eq 0; then
119 run_prog mhshow
$msgnum > $actual 2>&1
120 check
"$expected" "$actual" : encoded parameter value
124 start_test
'replacement character in parameter value'
125 #### The output of this test doesn't show it, but it covers the
126 #### noiconv: portion of get_param_value().
127 cat > $msgfile <<'EOF'
128 Subject: invalid parameter value charset
130 Content-Type: text/plain; charset*=invalid''%0Dus-ascii
133 cat > $expected <<EOF
135 Subject: invalid parameter value charset
139 [ part - text/plain - 0B ]
142 if test $skip_param_value_checks -eq 0; then
143 run_prog mhshow
$msgnum > $actual 2>&1
144 check
"$expected" "$actual"