summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2007-12-14 12:05:10 +0100
committermkanat%bugzilla.org <>2007-12-14 12:05:10 +0100
commit3f94214af2e2ec758a0b126aa3ef70be6544aaa9 (patch)
treeee648afa11af7ce106c69690cdd243a89f111ff3 /Bugzilla
parent173ef8133b3048eab4ef97a91623a852f8a267c9 (diff)
downloadbugzilla-3f94214af2e2ec758a0b126aa3ef70be6544aaa9.tar.gz
bugzilla-3f94214af2e2ec758a0b126aa3ef70be6544aaa9.tar.xz
Bug 405362: Bugzilla::Mailer couldn't handle utf-8 strings in the body, because encoding_set doesn't understand utf8 perl strings.
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=wurblzap, a=mkanat
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Mailer.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm
index a8ab64913..0040c855e 100644
--- a/Bugzilla/Mailer.pm
+++ b/Bugzilla/Mailer.pm
@@ -57,7 +57,15 @@ sub MessageToMTA {
my $email = ref($msg) ? $msg : Email::MIME->new($msg);
foreach my $part ($email->parts) {
- $part->charset_set('UTF-8') if Bugzilla->params->{'utf8'};
+ 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($part->body);
}