changeset 672:4d580bd8c47f

Add charset option to text/plain part header
author HIROSE Yuuji <yuuji@gentei.org>
date Tue, 12 May 2020 11:31:50 +0900
parents ae4dcd28fd39
children 42bf03cb3712
files sendmultipart.sh
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/sendmultipart.sh	Tue May 12 11:04:34 2020 +0900
+++ b/sendmultipart.sh	Tue May 12 11:31:50 2020 +0900
@@ -4,7 +4,7 @@
 # (C)2012,2015 by HIROSE Yuuji [yuuji(at)yatex.org]
 # You can obtain the latest version of this script from:
 #   http://www.gentei.org/~yuuji/software/sendmultipart.sh
-# Last modified Tue May 12 11:03:43 2020 on firestorm
+# Last modified Tue May 12 11:29:54 2020 on firestorm
 #
 # Typical usage:
 #  echo "Hi, here's photo I've taken.  Enjoy" | \
@@ -76,7 +76,7 @@
   esac
   filename=`echo $1|nkf -M`
   cat<<EOF
-Content-Type: text/plain; charset="$coding"
+Content-Type: text/plain; charset=$coding
 Content-Disposition: inline; filename="$filename"
 Content-Transfer-Encoding: $encoding
 
@@ -109,15 +109,16 @@
   echo
   for file in "$@"; do
     echo "--$boundary"
-    case `echo $file|tolower` in
-      *.txt|*.jis|*.sjis|*.euc|*.utf*)
-	cattextwithheader $file
+    ct=`file --mime-type - < "$file" | cut -d' ' -f2`
+    case "$ct" in
+      [Tt]ext/[Pp]lain*)
+	cattextwithheader "$file"
 	;;
       *)
-	echo -n "Content-Type: "
-	file --mime-type - < "$file" | cut -d' ' -f2
+	echo "Content-Type: $ct"
+	fn=${file##*/}
 	echo "Content-Transfer-Encoding: base64"
-	echo "Content-Disposition: inline; filename=\"$file\""
+	echo "Content-Disposition: inline; filename=\"$fn\""
 	echo
 	$base64 $file
 	;;

yatex.org