@cats = &get_visible_modules_categories();
@modules = map { @{$_->{'modules'}} } @cats;
-$charset = defined($force_charset) ? $force_charset : &get_charset();
print &popup_header();
print <<EOF;
<link rel="stylesheet" type="text/css" href="left.css" />
return @errs;
}
+# get_mail_charset(&mail, &body)
+# Returns the character set to use for the HTML page for some email
+sub get_mail_charset
+{
+my ($mail, $body) = @_;
+my $ctype;
+if ($body) {
+ $ctype = $body->{'header'}->{'content-type'};
+ }
+$ctype ||= $mail->{'header'}->{'content-type'};
+if ($ctype =~ /charset="([a-z0-9\-]+)"/i ||
+ $ctype =~ /charset='([a-z0-9\-]+)'/i ||
+ $ctype =~ /charset=([a-z0-9\-]+)/i) {
+ $charset = $1;
+ }
+}
+## Special handling of HTML header charset ($force_charset):
+## For japanese text(ISO-2022-JP/EUC=JP/SJIS), the HTML output and
+## text contents ($bodycontents) are already converted to EUC,
+## so overriding HTML charset to that in the mail header ($charset)
+## is generally wrong. (cf. mailbox/boxes-lib.pl:eucconv())
+if ( &get_charset() =~ /^EUC/i ) { # EUC-JP,EUC-KR
+ return undef;
+ }
+else {
+ return $charset;
+ }
+}
+
1;
# View a single email message
require './mailboxes-lib.pl';
-$force_charset = '';
+$main::force_charset = '';
&ReadParse();
&can_user($in{'user'}) || &error($text{'mail_ecannot'});
if (&is_user($in{'user'})) {
require './view-lib.pl';
if ($config{'charset'}) {
- $force_charset = $config{'charset'};
+ $main::force_charset = $config{'charset'};
}
if ($ENV{'CONTENT_TYPE'} !~ /boundary=/) {
&ReadParse();
{
return if ($main::done_webmin_header++);
my $ll;
-my $charset = defined($force_charset) ? $force_charset : &get_charset();
+my $charset = defined($main::force_charset) ? $main::force_charset
+ : &get_charset();
&PrintHeader($charset);
&load_theme_library();
if (defined(&theme_header)) {
{
return if ($main::done_webmin_header++);
my $ll;
-my $charset = defined($force_charset) ? $force_charset : &get_charset();
+my $charset = defined($main::force_charset) ? $main::force_charset
+ : &get_charset();
&PrintHeader($charset);
&load_theme_library();
if (defined(&theme_popup_header)) {