]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 723944: Plain-text only emails are mangled when they contain non-ASCII characters
authorFrédéric Buclin <LpSolit@gmail.com>
Thu, 16 Feb 2012 17:32:19 +0000 (18:32 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Thu, 16 Feb 2012 17:32:19 +0000 (18:32 +0100)
r=glob a=LpSolit

Bugzilla/Mailer.pm

index 5ee6fd2eb854db79d682a55d569c2e1b050d22da..7e42cb609f0d8904e078cfccc1cc55363b1921f1 100644 (file)
@@ -91,7 +91,11 @@ sub MessageToMTA {
         my ($part) = @_;
         return if $part->parts > 1; # Top-level
         my $content_type = $part->content_type || '';
-        if ($content_type !~ /;/) {
+        $content_type =~ /charset=['"](.+)['"]/;
+        # If no charset is defined or is the default us-ascii,
+        # then we encode the email to UTF-8 if Bugzilla has utf8 enabled.
+        # XXX - This is a hack to workaround bug 723944.
+        if (!$1 || $1 eq 'us-ascii') {
             my $body = $part->body;
             if (Bugzilla->params->{'utf8'}) {
                 $part->charset_set('UTF-8');