commit 1d6d142db1822664cb6ae61c72d8a9711ec9d7f4
parent e2acf5133d27fc8d5b682a9c5eeccbb80e046e30
Author: ukai <ukai>
Date: Tue, 29 Jan 2002 16:31:09 +0000
[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:
2 files changed, 28 insertions(+), 12 deletions(-)
diff --git 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
diff --git a/scripts/w3mmail.cgi.in b/scripts/w3mmail.cgi.in
@@ -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);