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
24 test "$ICONV_ENABLED" -eq 1 && text_size=11
26 expected=$MH_TEST_DIR/$$.expected
27 actual=$MH_TEST_DIR/$$.actual
29 echo 'mhshow-charset-windows-1252: echo "This is a test"' >> "$MH"
31 # Write message with bogus quoted-printable data.
32 start_test 'Write message with bogus quoted-printable data'
34 msgnum=`basename $msgfile`
40 Content-Type: text/plain; charset=windows-1252
41 Content-Transfer-Encoding: quoted-printable
42 Content-Description: bogus quoted-printable data
43 Date: Sun, 18 Dec 2005 00:52:39 +0100
50 Date: Sun, 18 Dec 2005 00:52:39 +0100
56 Content-Description: bogus quoted-printable data
58 [ part - text/plain - bogus quoted-printable data ${text_size}B ]
62 run_prog mhshow $msgnum > $actual 2>&1
63 check "$expected" "$actual" 'keep first' : bogus quoted-printable data
66 start_test 'locale profile component'
67 #### Used LC_ALL above, now use locale profile component instead.
68 printf "locale: $LC_ALL\n" >> "${MH}"
71 run_prog mhshow $msgnum > $actual 2>&1
72 check "$expected" "$actual" : locale profile component
75 #### RFC 2231 defines the extended value syntax:
76 #### extended-initial-value := [charset] "'" [language] "'"
77 #### extended-other-values
78 #### used below, where language is blank.
80 start_test 'Encoded parameter value'
82 msgnum=`basename $msgfile`
83 #### Use a charset to exercise the iconv code, if it's available,
84 #### in get_param_value(). The Content-Type charset is UTF-8, encoded
85 #### to exercise iconv.
91 Content-Type: text/plain; charset*=ISO-2022-KR''%1b%24%29%43%55%54%46%2d%38
92 Content-Transfer-Encoding: quoted-printable
93 Content-Description: bogus quoted-printable data
94 Date: Sun, 18 Dec 2005 00:52:39 +0100
101 Date: Sun, 18 Dec 2005 00:52:39 +0100
103 From: foo@example.edu
107 Content-Description: bogus quoted-printable data
109 [ part - text/plain - bogus quoted-printable data 11B ]
113 if test "$ICONV_ENABLED" -eq 1; then
114 run_prog mhshow $msgnum > $actual 2>&1
115 check "$expected" "$actual" : encoded parameter value
119 start_test 'replacement character in parameter value'
120 cat > $msgfile <<'EOF'
121 Subject: invalid parameter value charset
123 Content-Type: text/plain; charset*=invalid''%0Dus-ascii
126 cat > $expected <<EOF
128 Subject: invalid parameter value charset
132 [ part - text/plain - 0B ]
135 run_prog mhshow $msgnum > $actual 2>&1
136 check "$expected" "$actual"