]>
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 utf8
="`printf '\344' | iconv -f EBCDIC-US -t UTF-8 2>/dev/null`" &&
34 skip_param_value_checks
=1
37 expected
=$MH_TEST_DIR/$$.expected
38 actual
=$MH_TEST_DIR/$$.actual
40 echo 'mhshow-charset-windows-1252: echo "This is a test"' >> "$MH"
42 # Write message with bogus quoted-printable data.
43 start_test
'Write message with bogus quoted-printable data'
45 msgnum
=`basename $msgfile`
51 Content-Type: text/plain; charset=windows-1252
52 Content-Transfer-Encoding: quoted-printable
53 Content-Description: bogus quoted-printable data
54 Date: Sun, 18 Dec 2005 00:52:39 +0100
61 Date: Sun, 18 Dec 2005 00:52:39 +0100
67 Content-Description: bogus quoted-printable data
69 [ part - text/plain - bogus quoted-printable data ${text_size}B ]
73 run_prog mhshow
$msgnum > $actual 2>&1
74 check
"$expected" "$actual" 'keep first' : bogus quoted
-printable data
77 start_test
'locale profile component'
78 #### Used LC_ALL above, now use locale profile component instead.
79 printf "locale: $LC_ALL\n" >> "${MH}"
82 run_prog mhshow
$msgnum > $actual 2>&1
83 check
"$expected" "$actual" : locale profile component
86 if test $skip_param_value_checks -eq 1; then
92 start_test
'Encoded parameter value'
94 msgnum
=`basename $msgfile`
95 #### The encoded charset name is really UTF-8 encoded,
96 #### but say it's UTF-16 to exercise the iconv code,
97 #### if it's available, in get_param_value().
103 Content-Type: text/plain; charset*=EBCDIC-US''%e4%e3%c6%60%f8
104 Content-Transfer-Encoding: quoted-printable
105 Content-Description: bogus quoted-printable data
106 Date: Sun, 18 Dec 2005 00:52:39 +0100
111 cat > $expected <<EOF
113 Date: Sun, 18 Dec 2005 00:52:39 +0100
115 From: foo@example.edu
119 Content-Description: bogus quoted-printable data
121 [ part - text/plain - bogus quoted-printable data 11B ]
125 run_prog mhshow
$msgnum > $actual 2>&1
126 check
"$expected" "$actual" : encoded parameter value
129 start_test
'replacement character in parameter value'
130 #### The output of this test doesn't show it, but it covers the
131 #### noiconv: portion of get_param_value().
132 cat > $msgfile <<'EOF'
133 Subject: invalid parameter value charset
135 Content-Type: text/plain; charset*=invalid''%0Dus-ascii
138 cat > $expected <<EOF
140 Subject: invalid parameter value charset
144 [ part - text/plain - 0B ]
147 run_prog mhshow
$msgnum > $actual 2>&1
148 check
"$expected" "$actual"