summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorwurblzap%gmail.com <>2008-04-09 21:27:32 +0200
committerwurblzap%gmail.com <>2008-04-09 21:27:32 +0200
commit09e9e8b9dba58ae262c0ce664561373f4380205f (patch)
treeab58878bd4d9358662500b7ce1fe4cef9d46ac37 /Bugzilla
parent1f2af64c1fb0d1a45d932c5708d0c53f03c89278 (diff)
downloadbugzilla-09e9e8b9dba58ae262c0ce664561373f4380205f.tar.gz
bugzilla-09e9e8b9dba58ae262c0ce664561373f4380205f.tar.xz
Bug 311563 – Make whining permit utf8 in whining reports.
Patch by Marc Schumann <wurblzap@gmail.com>; r=mkanat; a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Install/Requirements.pm6
-rw-r--r--Bugzilla/Mailer.pm26
2 files changed, 21 insertions, 11 deletions
diff --git a/Bugzilla/Install/Requirements.pm b/Bugzilla/Install/Requirements.pm
index 0bfa9ec87..b8695c824 100644
--- a/Bugzilla/Install/Requirements.pm
+++ b/Bugzilla/Install/Requirements.pm
@@ -89,7 +89,11 @@ sub REQUIRED_MODULES {
version => ON_WINDOWS ? '2.16' : '2.00'
},
{
- # This will pull in Email::MIME for us, also.
+ package => 'Email-MIME',
+ module => 'Email::MIME',
+ version => '1.861'
+ },
+ {
package => 'Email-MIME-Modifier',
module => 'Email::MIME::Modifier',
version => 0
diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm
index 9330486db..5c7a75450 100644
--- a/Bugzilla/Mailer.pm
+++ b/Bugzilla/Mailer.pm
@@ -57,18 +57,24 @@ sub MessageToMTA {
return if $method eq 'None';
my $email = ref($msg) ? $msg : Email::MIME->new($msg);
- foreach my $part ($email->parts) {
- if (Bugzilla->params->{'utf8'}) {
- $part->charset_set('UTF-8');
- # encoding_set works only with bytes, not with utf8 strings.
- my $raw = $part->body_raw;
- if (utf8::is_utf8($raw)) {
- utf8::encode($raw);
- $part->body_set($raw);
+ $email->walk_parts(sub {
+ my ($part) = @_;
+ return if $part->parts > 1; # Top-level
+ my $content_type = $part->content_type || '';
+ if ($content_type !~ /;/) {
+ my $body = $part->body;
+ if (Bugzilla->params->{'utf8'}) {
+ $part->charset_set('UTF-8');
+ # encoding_set works only with bytes, not with utf8 strings.
+ my $raw = $part->body_raw;
+ if (utf8::is_utf8($raw)) {
+ utf8::encode($raw);
+ $part->body_set($raw);
+ }
}
+ $part->encoding_set('quoted-printable') if !is_7bit_clean($body);
}
- $part->encoding_set('quoted-printable') if !is_7bit_clean($part->body);
- }
+ });
# MIME-Version must be set otherwise some mailsystems ignore the charset
$email->header_set('MIME-Version', '1.0') if !$email->header('MIME-Version');