From 4415fdb0f4785dff24c9773f85a9b32885c385ac Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Fri, 6 Nov 2020 13:35:39 +0200 Subject: [PATCH] Bug 26948: Remove double encoding from sent emails MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The sent emails from Koha were garbled / double encoded because Koha::Email now after the refactoring and moving to use Email::Stuffer handles the encoding itself. Previously the Koha::Email callee had to handle the encoding. This patch removes the double encoding in the email subject and content. To test: 1) Put some UTF-8 characters like ä in the HOLD template subject and body 2) Create hold and check-in an item to make it Waiting and cause the email to be send 3) Notice the email comes garbled / double encoded 4) Apply patch 5) Repeat step 2) and notice the email comes without any issues in encoding and look OK. 6) Make sure "prove t/Koha/Email.t" and "prove t/db_dependent/Letters.t" and passes Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- C4/Letters.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index 5779dc828b..d3e354f6c6 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -1315,11 +1315,9 @@ sub _send_message_by_email { } } - # Encode subject line separately - $message->{subject} = encode('MIME-Header', $message->{'subject'} ); my $subject = $message->{'subject'}; - my $content = encode('UTF-8', $message->{'content'}); + my $content = $message->{'content'}; my $content_type = $message->{'content_type'} || 'text/plain; charset="UTF-8"'; my $is_html = $content_type =~ m/html/io; -- 2.39.5