summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2012-02-16 18:27:48 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2012-02-16 18:27:48 +0100
commite95d52f72ef1b9c964c826d8a350a55697cb0d95 (patch)
tree1f8ccc0be3dc3ec98458694c240a45ebd8283893
parentb670bf1d4e570b77283b6f148eb0a859aa2d8bf9 (diff)
downloadbugzilla-e95d52f72ef1b9c964c826d8a350a55697cb0d95.tar.gz
bugzilla-e95d52f72ef1b9c964c826d8a350a55697cb0d95.tar.xz
Bug 723944: Plain-text only emails are mangled when they contain non-ASCII characters
r=glob a=LpSolit
-rw-r--r--Bugzilla/Mailer.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm
index fc51f0d47..5ef731063 100644
--- a/Bugzilla/Mailer.pm
+++ b/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');