From: mkanat%bugzilla.org <> Date: Mon, 28 Jan 2008 00:13:09 +0000 (+0000) Subject: Bug 411544: Subject lines in emails were still being improperly line-broken. This... X-Git-Tag: bugzilla-3.0.4~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2afcdb261b2a90013f39b6c1eb578b57a4a8dc85;p=thirdparty%2Fbugzilla.git Bug 411544: Subject lines in emails were still being improperly line-broken. This patch makes encoded headers not break at all. Patch By Jeff Lawson r=mkanat, a=mkanat --- diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm index 956f30139d..8e18d5e319 100644 --- a/Bugzilla/Mailer.pm +++ b/Bugzilla/Mailer.pm @@ -44,6 +44,7 @@ use Bugzilla::Util; use Date::Format qw(time2str); use Encode qw(encode); +use Encode::MIME::Header; use Email::Address; use Email::MIME; # Loading this gives us encoding_set. @@ -68,9 +69,11 @@ sub MessageToMTA { foreach my $header qw(From To Cc Reply-To Sender Errors-To Subject) { if (my $value = $email->header($header)) { $value = Encode::decode("UTF-8", $value) if Bugzilla->params->{'utf8'}; + + # avoid excessive line wrapping done by Encode. + local $Encode::Encoding{'MIME-Q'}->{'bpl'} = 998; + my $encoded = encode('MIME-Q', $value); - # Encode adds unnecessary line breaks, with two spaces after each. - $encoded =~ s/\n / /g; $email->header_set($header, $encoded); } }