Origin: https://github.com/OTRS/otrs/commit/3200f38e4ece3b73c1d8f98642b0bf30f5e39043 Bug-Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=532812 From 3200f38e4ece3b73c1d8f98642b0bf30f5e39043 Mon Sep 17 00:00:00 2001 From: Michiel Beijen Date: Mon, 4 Nov 2013 11:54:42 +0100 Subject: [PATCH] Fixed: Perl 5.18.1 problems with MIME::Entity (bug#9832). See: http://search.cpan.org/~rjbs/perl-5.18.0/pod/perldiag.pod#Strings_with_code_points_over_0xFF_may_not_be_mapped_into_in-memory_file_handles http://blogs.perl.org/users/tony_cook/2013/02/perl-io-on-scalars.html Thanks to Niko Tyni at the Debian team for investigating! --- CHANGES.md | 1 + Kernel/System/Email.pm | 9 +++------ scripts/test/Email.t | 11 +++++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index da75490..061e647 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,5 @@ #3.2.12 2013-11-05 + - 2013-11-04 Fixed bug#[9832](http://bugs.otrs.org/show_bug.cgi?id=9832) - Perl 5.18.1 problems with MIME::Entity. - 2013-10-31 Updated French translation, thanks to Olivier Sallou! - 2013-10-31 Fixed bug#[9910](http://bugs.otrs.org/show_bug.cgi?id=9910) - Startup warnings/errors with Perl 5.18.1. - 2013-10-29 Fixed bug#[9753](http://bugs.otrs.org/show_bug.cgi?id=9753) - META HTTP-EQUIV="Refresh" tag not stripped from HTML email. diff --git a/Kernel/System/Email.pm b/Kernel/System/Email.pm index c36a5ed..a40f50f 100644 --- a/Kernel/System/Email.pm +++ b/Kernel/System/Email.pm @@ -313,11 +313,6 @@ sub Send { $Header{Encoding} = $Self->{ConfigObject}->Get('SendmailEncodingForce'); } - # body encode if utf8 and base64 is used - if ( $Header{Encoding} =~ /utf(8|-8)/i && $Header{Encoding} =~ /base64/i ) { - $Self->{EncodeObject}->EncodeOutput( \$Param{Body} ); - } - # check and create message id if ( $Param{'Message-ID'} ) { $Header{'Message-ID'} = $Param{'Message-ID'}; @@ -339,7 +334,9 @@ sub Send { ); } - # build MIME::Entity + # build MIME::Entity, Data should be bytes, not utf-8 + # see http://bugs.otrs.org/show_bug.cgi?id=9832 + $Self->{EncodeObject}->EncodeOutput( \$Param{Body} ); my $Entity = MIME::Entity->build( %Header, Data => $Param{Body} ); # set In-Reply-To and References header diff --git a/scripts/test/Email.t b/scripts/test/Email.t index 1adc40d..8900712 100644 --- a/scripts/test/Email.t +++ b/scripts/test/Email.t @@ -62,6 +62,17 @@ my @Tests = ( Charset => 'utf8', }, }, + { + Name => 'utf8 - high unicode characters', + Data => { + From => '"Служба поддержки (support)" ', + To => 'friend@example.com', + Subject => 'Test related to bug#9832', + Body => "\x{2660}", + Type => 'text/plain', + Charset => 'utf8', + }, + }, ); my $Count = 0; -- 2.0.4