+
+grep -v 'mhshow-show-text/plain:' "$MH" >"$MH.new"
+mv -f "$MH.new" "$MH"
+cat >>"$MH" <<'EOF'
+mhshow-show-text/plain: charset=%{charset}; echo ${charset:+-I $charset}
+EOF
+
+# check expansion of embedded %{charset} with no text following
+cat >"$expected" <<'EOF'
+Date: Sun, 18 Dec 2005 00:52:39 +0100
+To: bar@example.edu
+From: foo@example.edu
+Subject: test display with %{charset} expansion
+
+MIME-Version: 1.0
+
+-I UTF-8
+EOF
+
+run_prog mhshow -nopause prev >"$actual" 2>&1
+check "$expected" "$actual"
+
+
+# check expansion of empty embedded %{charset} with no text following
+cat >"$expected" <<'EOF'
+Date: Sun, 18 Dec 2005 00:52:39 +0100
+To: bar@example.edu
+From: foo@example.edu
+Subject: test display with empty %{charset} expansion
+
+MIME-Version: 1.0
+
+
+EOF
+
+run_prog mhshow -nopause last >"$actual" 2>&1
+check "$expected" "$actual"
+
+
+sed -e 's%\(mhshow-show-text/plain:.*\)%\1 file%' "$MH" >"$MH.new"
+mv -f "$MH.new" "$MH"
+
+# check expansion of embedded %{charset} with text following
+cat >"$expected" <<'EOF'
+Date: Sun, 18 Dec 2005 00:52:39 +0100
+To: bar@example.edu
+From: foo@example.edu
+Subject: test display with %{charset} expansion
+
+MIME-Version: 1.0
+
+-I UTF-8 file
+EOF
+
+run_prog mhshow -nopause prev >"$actual" 2>&1
+check "$expected" "$actual"
+
+
+# check expansion of empty embedded %{charset} with text following
+cat >"$expected" <<'EOF'
+Date: Sun, 18 Dec 2005 00:52:39 +0100
+To: bar@example.edu
+From: foo@example.edu
+Subject: test display with empty %{charset} expansion
+
+MIME-Version: 1.0
+
+file
+EOF
+
+run_prog mhshow -nopause last >"$actual" 2>&1
+check "$expected" "$actual"
+
+
+sed -e 's/charset/method/g' "$MH" >"$MH.new"
+mv -f "$MH.new" "$MH"
+
+# check parameter value quoting
+msgfile=`mhpath new`
+cat >"$msgfile" <<'EOF'
+From: foo@example.edu
+To: bar@example.edu
+Subject: test C-T parameter expansion quoting
+MIME-Version: 1.0
+Content-Type: text/plain; method=$QUOTEME'
+Content-Transfer-Encoding: quoted-printable
+Date: Sun, 18 Dec 2005 00:52:39 +0100
+
+4 =F7 2 =3D 2
+EOF
+
+cat >"$expected" <<'EOF'
+Date: Sun, 18 Dec 2005 00:52:39 +0100
+To: bar@example.edu
+From: foo@example.edu
+Subject: test C-T parameter expansion quoting
+
+MIME-Version: 1.0
+
+-I $QUOTEME' file
+EOF
+
+run_prog mhshow -nopause last >"$actual" 2>&1
+check "$expected" "$actual"
+
+
+sed -e 's/method/unknown/g' "$MH" >"$MH.new"
+mv -f "$MH.new" "$MH"
+
+# check that unknown parameter is not expanded
+msgfile=`mhpath new`
+cat >"$msgfile" <<'EOF'
+From: foo@example.edu
+To: bar@example.edu
+Subject: test display with unknown C-T parameter expansion
+MIME-Version: 1.0
+Content-Type: text/plain; charset=windows-1252
+Content-Transfer-Encoding: quoted-printable
+Date: Sun, 18 Dec 2005 00:52:39 +0100
+
+4 =F7 2 =3D 2
+EOF
+
+cat >"$expected" <<'EOF'
+Date: Sun, 18 Dec 2005 00:52:39 +0100
+To: bar@example.edu
+From: foo@example.edu
+Subject: test display with unknown C-T parameter expansion
+
+MIME-Version: 1.0
+
+file
+EOF
+
+run_prog mhshow -nopause last >"$actual" 2>&1
+check "$expected" "$actual"
+
+
+grep -v '^mhshow-show-text/plain: ' "$MH" >>"$MH.new"
+mv -f "$MH.new" "$MH"
+cat >>"$MH" <<EOF
+mhshow-show-text/plain: true '%F' %F
+EOF
+
+# check parameter value quoting with text following
+msgfile=`mhpath new`
+cat >"$msgfile" <<'EOF'
+From: foo@example.edu
+To: bar@example.edu
+Subject: check parameter value quoting with text following
+MIME-Version: 1.0
+Content-Type: text/plain
+Date: Sun, 18 Dec 2005 00:52:39 +0100
+
+This is a test.
+EOF
+
+cat >"$expected" <<'EOF'
+Date: Sun, 18 Dec 2005 00:52:39 +0100
+To: bar@example.edu
+From: foo@example.edu
+Subject: check parameter value quoting with text following
+
+MIME-Version: 1.0
+
+EOF
+
+run_prog mhshow -nopause last >"$actual" 2>&1
+check "$expected" "$actual"
+
+