From c16e2d814a63b41f0e102253c0e4df1f87277d47 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" Date: Thu, 16 Feb 2012 17:31:28 +0000 Subject: [PATCH] Bug 723944: Plain-text only emails are mangled when they contain non-ASCII characters r=glob a=LpSolit git-svn-id: svn://10.0.0.236/trunk@263428 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/.bzrrev | 2 +- mozilla/webtools/bugzilla/Bugzilla/Mailer.pm | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mozilla/webtools/bugzilla/.bzrrev b/mozilla/webtools/bugzilla/.bzrrev index b5798ea1cf2..0b862609571 100644 --- a/mozilla/webtools/bugzilla/.bzrrev +++ b/mozilla/webtools/bugzilla/.bzrrev @@ -1 +1 @@ -8113 \ No newline at end of file +8114 \ No newline at end of file diff --git a/mozilla/webtools/bugzilla/Bugzilla/Mailer.pm b/mozilla/webtools/bugzilla/Bugzilla/Mailer.pm index fc51f0d47b8..5ef7310635d 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Mailer.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/Mailer.pm @@ -133,7 +133,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');