From b9388c4f60704e63c7b3cbec90425037c15ce0d1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 14 Nov 2013 12:17:38 +0100 Subject: [PATCH] Bug 10605: fix encoding issue in basket email (OPAC) There is an encoding issue on the received mail. Here, we have to keep the encode_qp in order not to break links (= is a special char for email https://en.wikipedia.org/wiki/MIME#Encoded-Word). Signed-off-by: Katrin Fischer Signed-off-by: Brendan Gallagher Signed-off-by: Galen Charlton (cherry picked from commit 4290fa60ef0fd93f1c0b51485f3b3ec74f316043) Signed-off-by: Fridolin SOMERS (cherry picked from commit adb91828bd95a006a0db89756dd51f3728de5034) Signed-off-by: Tomas Cohen Arazi --- opac/opac-sendbasket.pl | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl index da74745f2e..ca3a973638 100755 --- a/opac/opac-sendbasket.pl +++ b/opac/opac-sendbasket.pl @@ -127,25 +127,33 @@ if ( $email_add ) { my $body; # Analysing information and getting mail properties - if ( $template_res =~ /\n(.*)\n?/s ) { - $mail{'subject'} = $1; + + if ( $template_res =~ /(.*)/s ) { + $mail{subject} = $1; + $mail{subject} =~ s|\n?(.*)\n?|$1|; } else { $mail{'subject'} = "no subject"; } my $email_header = ""; - if ( $template_res =~ /
\n(.*)\n?/s ) { - $email_header = encode_qp($1); + if ( $template_res =~ /
(.*)/s ) { + $email_header = $1; + $email_header =~ s|\n?(.*)\n?|$1|; } my $email_file = "basket.txt"; - if ( $template_res =~ /\n(.*)\n?/s ) { + if ( $template_res =~ /(.*)/s ) { $email_file = $1; + $email_file =~ s|\n?(.*)\n?|$1|; } - if ( $template_res =~ /\n(.*)\n?/s ) { - $body = encode_qp($1); + if ( $template_res =~ /(.*)/s ) { + $body = $1; + $body =~ s|\n?(.*)\n?|$1|; + $body = encode("UTF-8", encode_qp($body)); } + $mail{body} = $body; + my $boundary = "====" . time() . "===="; $mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; -- 2.39.5