From ed654e9a89a59488049728b34eee1cc7a2c3c31c Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Fri, 23 Nov 2018 11:30:49 +0100 Subject: [PATCH] Bug 21874: Fix encoding of cart and list email subjects MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The subject of the cart and list emails is not correctly encoded and displays incorrectly in some email clients. To test: Lists: - Create a list, name it using umlauts or other diacritics Example: Jugendbücher (books for youths in German) - Add some items to your list - Email yourself the list - Verify that the email subject is broken Cart: - Install another language with non-latin characters like Greek - Fill the cart with some titles - Send yourself the cart - Verify that the email subject is broken Note: Some email clients display correctly, others not. It's known to be incorrect in Outlook and web.de, displaying nicely in Thunderbird. Signed-off-by: Marcel de Rooy Tested all four scripts by manipulating the cart text too in templates. Follow-up handles intranet sendshelf. Note: I asked Katrin to remove the encode UTF-8 statements, since we convert to MIME and the subject line should never be UTF-8. Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens (cherry picked from commit e40bb00ab8da87c8c5d6e660de928d24b887df17) Signed-off-by: Jesse Maseto (cherry picked from commit c58f6e5a12a711fe81e7c4f393f1c04db2eae5bb) Signed-off-by: Fridolin Somers --- basket/sendbasket.pl | 2 +- opac/opac-sendbasket.pl | 2 +- opac/opac-sendshelf.pl | 2 +- virtualshelves/sendshelf.pl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/basket/sendbasket.pl b/basket/sendbasket.pl index 224db2de6f..6720fc8ffe 100755 --- a/basket/sendbasket.pl +++ b/basket/sendbasket.pl @@ -112,7 +112,7 @@ if ( $email_add ) { if ( $template_res =~ /(.*)/s ) { $mail{subject} = $1; $mail{subject} =~ s|\n?(.*)\n?|$1|; - $mail{subject} = Encode::encode("UTF-8", $mail{subject}); + $mail{subject} = encode('MIME-Header',$mail{subject}); } else { $mail{'subject'} = "no subject"; } diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl index ab03e52ab7..8a3fd44dbf 100755 --- a/opac/opac-sendbasket.pl +++ b/opac/opac-sendbasket.pl @@ -130,7 +130,7 @@ if ( $email_add ) { if ( $template_res =~ /(.*)/s ) { $mail{subject} = $1; $mail{subject} =~ s|\n?(.*)\n?|$1|; - $mail{subject} = Encode::encode("UTF-8", $mail{subject}); + $mail{subject} = encode('MIME-Header',$mail{subject}); } else { $mail{'subject'} = "no subject"; } diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl index 3c19e61ebf..9e34710899 100755 --- a/opac/opac-sendshelf.pl +++ b/opac/opac-sendshelf.pl @@ -132,7 +132,7 @@ if ( $email ) { $mail{subject} =~ s|\n?(.*)\n?|$1|; } else { $mail{'subject'} = "no subject"; } - $mail{subject} = Encode::encode("UTF-8", $mail{subject}); + $mail{subject} = encode('MIME-Header', $mail{subject}); my $email_header = ""; if ( $template_res =~ /
(.*)/s ) { diff --git a/virtualshelves/sendshelf.pl b/virtualshelves/sendshelf.pl index 9880efd680..4f6bdc186c 100755 --- a/virtualshelves/sendshelf.pl +++ b/virtualshelves/sendshelf.pl @@ -114,7 +114,7 @@ if ($email) { # Analysing information and getting mail properties if ( $template_res =~ /(.*)/s ) { - $mail{'subject'} = Encode::encode("UTF-8", $1); + $mail{'subject'} = encode('MIME-Header', $1); $mail{subject} =~ s|\n?(.*)\n?|$1|; } else { $mail{'subject'} = "no subject"; } -- 2.39.5