]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 311563 รข\80\93 Make whining permit utf8 in whining reports.
authorwurblzap%gmail.com <>
Wed, 9 Apr 2008 19:27:32 +0000 (19:27 +0000)
committerwurblzap%gmail.com <>
Wed, 9 Apr 2008 19:27:32 +0000 (19:27 +0000)
Patch by Marc Schumann <wurblzap@gmail.com>;
r=mkanat; a=LpSolit

Bugzilla/Install/Requirements.pm
Bugzilla/Mailer.pm

index 0bfa9ec87baee813b2da8d03863fa5e887a1c133..b8695c82415b7d2a111f51f2531b16e731282426 100644 (file)
@@ -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
index 9330486db51ca48c1b5fb975d11cd30b6272993d..5c7a754502d992bfdcdd86423a6d8ee989528f61 100644 (file)
@@ -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');