aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-01-29 16:31:09 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-01-29 16:31:09 +0000
commit506e62aae20a7230a69012999f2cdf283240b1d0 (patch)
treed07a8224481581429699ee99a59bb69a24dacefa
parent[w3m-dev 02920] don't use inttypes.h and/or stdint.h (diff)
downloadw3m-506e62aae20a7230a69012999f2cdf283240b1d0.tar.gz
w3m-506e62aae20a7230a69012999f2cdf283240b1d0.zip
[w3m-dev 02926] fixed w3mmail.cgi
* scripts/w3mmail.cgi.in: dont MIME encode for preview * scripts/w3mmail.cgi.in (lang_body): add 7bit/8bit flag arg * scripts/w3mmail.cgi.in: fix hidden from value * scripts/w3mmail.cgi.in (lang_setup): check $LC_ALL, $LC_CTYPE * scripts/w3mmail.cgi.in (lang_header_default): fix MIME encode word From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r--ChangeLog11
-rwxr-xr-xscripts/w3mmail.cgi.in33
2 files changed, 30 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index d53e7a1..38f89b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2002-01-30 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
+ * [w3m-dev 02926] fixed w3mmail.cgi
+ * scripts/w3mmail.cgi.in: dont MIME encode for preview
+ * scripts/w3mmail.cgi.in (lang_body): add 7bit/8bit flag arg
+ * scripts/w3mmail.cgi.in: fix hidden from value
+ * scripts/w3mmail.cgi.in (lang_setup): check $LC_ALL, $LC_CTYPE
+ * scripts/w3mmail.cgi.in (lang_header_default): fix MIME encode word
+
+2002-01-30 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 02920] don't use inttypes.h and/or stdint.h
* mktable.c: remove inttypes.h, uintptr_t, use unsigned long instead
* configure: remove inttypes.h detection
@@ -2346,4 +2355,4 @@
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.270 2002/01/29 16:23:37 ukai Exp $
+$Id: ChangeLog,v 1.271 2002/01/29 16:31:09 ukai Exp $
diff --git a/scripts/w3mmail.cgi.in b/scripts/w3mmail.cgi.in
index 1dafac3..9cfe5a0 100755
--- a/scripts/w3mmail.cgi.in
+++ b/scripts/w3mmail.cgi.in
@@ -1,6 +1,6 @@
#!@PERL@
-$rcsid = q$Id: w3mmail.cgi.in,v 1.7 2002/01/28 14:44:56 ukai Exp $;
+$rcsid = q$Id: w3mmail.cgi.in,v 1.8 2002/01/29 16:31:09 ukai Exp $;
($id = $rcsid) =~ s/^.*,v ([\d\.]*).*/$1/;
($prog=$0) =~ s/.*\///;
@@ -96,15 +96,15 @@ if ($query =~ s/^\w+://) {
print "<pre>\n";
foreach $h (keys %opt) {
$qh = &html_quote($h);
- $v{$h} = &lang_header(&lang_html_quote($opt{$h}));
+ $v{$h} = &lang_html_quote($opt{$h});
if ($v{$h}) {
print "\u$qh: $v{$h}\n";
}
}
- ($cs,$cte,$body) = &lang_body(&lang_html_quote($body));
+ ($cs,$cte,$body) = &lang_body(&lang_html_quote($body), 0);
print "Mime-Version: 1.0\n";
print "Content-Type: text/plain; charset=$cs\n";
- print "Content-Transfer-Encoding: $cte\n";
+# print "Content-Transfer-Encoding: $cte\n";
print "User-Agent: $ENV{'SERVER_SOFTWARE'} $prog/$id\n";
print "\n";
print $body;
@@ -115,7 +115,7 @@ if ($query =~ s/^\w+://) {
print "<table>\n";
if ($opt{'from'}) {
print "<tr><td>From:<td>$v{'from'}\n";
- print "<input type='hidden' name='from' value=\"$v\">\n";
+ print "<input type='hidden' name='from' value=\"$v{'from'}\">\n";
delete $opt{'from'};
}
foreach $h ('to', 'cc', 'bcc', 'subject') {
@@ -152,7 +152,7 @@ if ($query =~ s/^\w+://) {
print MAIL "\u$h: $v\n";
}
}
- ($cs,$cte,$body) = &lang_body($body);
+ ($cs,$cte,$body) = &lang_body($body, 1);
print MAIL "Mime-Version: 1.0\n";
print MAIL "Content-Type: text/plain; charset=$cs\n";
print MAIL "Content-Transfer-Encoding: $cte\n";
@@ -175,7 +175,7 @@ if ($query =~ s/^\w+://) {
}
sub lang_setup {
- $lang = $ENV{'LANG'};
+ $lang = $ENV{'LC_ALL'} || $ENV{'LC_CTYPE'} || $ENV{'LANG'};
if ($lang =~ /^ja/i) {
eval "use NKF;";
if (! $@) {
@@ -215,16 +215,21 @@ sub lang_html_quote {
sub lang_header_default {
local($h) = @_;
if ($h =~ s/([\x80-\xFF])/sprintf("=%02x", ord($1))/ge) {
- return "=iso-8859-1?Q?$h?=";
+ return "=?iso-8859-1?Q?$h?=";
} else {
return $h;
}
}
sub lang_body_default {
- local($body) = @_;
- if ($body =~ s/([\x80-\xFF])/sprintf("=%02x", ord($1))/ge) {
- return ("iso-8859-1", "quoted-printable", $body);
+ local($body, $_7bit) = @_;
+ if ($body =~ /[\x80-\xFF]/) {
+ if ($_7bit) {
+ $body =~ s/([\x80-\xFF])/sprintf("=%02x", ord($1))/ge;
+ return ("iso-8859-1", "quoted-printable", $body);
+ } else {
+ return ("iso-8859-1", "8bit", $body);
+ }
} else {
return ("US-ASCII", "7bit", $body);
}
@@ -241,9 +246,11 @@ sub lang_header_ja {
}
sub lang_body_ja {
- local($body) = @_;
+ local($body, $_7bit) = @_;
if ($body =~ /[\x80-\xFF]/ || $body =~ /\033[\$\(][BJ@]/) {
- $body = &conv_nkf("-j", $body);
+ if ($_7bit) {
+ $body = &conv_nkf("-j", $body);
+ }
return ("ISO-2022-JP", "7bit", $body);
} else {
return ("US-ASCII", "7bit", $body);