From 907aa78750e7983c70b2ad8baa26e0556be4d56d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 14 Apr 2014 16:33:56 +0200 Subject: [PATCH] Bug 11944: Fix encoding on sending emails This patch fixes 2 places where mails were badly encoded: 1/ At the opac and the intranet, on sending baskets 2/ At the opac and the intranet, on sending shelf/list Test plan: Shelf/List: - Create a list with non-latin characters in the name. - Add some items containing non-latin characters in their content. - Send the list by email Basket/Cart: - Add some items containing non-latin characters in their content to your cart.. - Send the cart by email --- basket/sendbasket.pl | 2 +- opac/opac-sendbasket.pl | 2 +- opac/opac-sendshelf.pl | 4 ++-- virtualshelves/sendshelf.pl | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/basket/sendbasket.pl b/basket/sendbasket.pl index d4cec52..0562957 100755 --- a/basket/sendbasket.pl +++ b/basket/sendbasket.pl @@ -133,7 +133,7 @@ if ( $email_add ) { if ( $template_res =~ /(.*)/s ) { $body = $1; $body =~ s|\n?(.*)\n?|$1|; - $body = encode("UTF-8", encode_qp($body)); + $body = encode_qp(Encode::encode("UTF-8", $body)); } my $boundary = "====" . time() . "===="; diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl index 06a555d..abf9710 100755 --- a/opac/opac-sendbasket.pl +++ b/opac/opac-sendbasket.pl @@ -149,7 +149,7 @@ if ( $email_add ) { if ( $template_res =~ /(.*)/s ) { $body = $1; $body =~ s|\n?(.*)\n?|$1|; - $body = encode("UTF-8", encode_qp($body)); + $body = encode_qp(Encode::encode("UTF-8", $body)); } $mail{body} = $body; diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl index 8bf71f8..902bd81 100755 --- a/opac/opac-sendshelf.pl +++ b/opac/opac-sendshelf.pl @@ -21,7 +21,7 @@ use strict; use warnings; use CGI qw ( -utf8 ); -use Encode; +use Encode qw( encode ); use Carp; use Mail::Sendmail; @@ -134,7 +134,7 @@ if ( $email ) { : "list.txt"; my ($body) = $template_res =~ /\n(.*)\n?/s; - $body = encode_qp($body); + $body = encode_qp(Encode::encode("UTF-8", $body)); my $boundary = "====" . time() . "===="; diff --git a/virtualshelves/sendshelf.pl b/virtualshelves/sendshelf.pl index 59cfd37..f0e10b4 100755 --- a/virtualshelves/sendshelf.pl +++ b/virtualshelves/sendshelf.pl @@ -21,7 +21,7 @@ use strict; use warnings; use CGI qw ( -utf8 ); -use Encode qw(encode); +use Encode qw( encode ); use Carp; use Mail::Sendmail; @@ -131,7 +131,7 @@ if ( $email ) { $email_file = $1; } - if ( $template_res =~ /\n(.*)\n/s ) { $body = encode_qp($1); } + if ( $template_res =~ /\n(.*)\n/s ) { $body = decode_qp(Encode::encode("UTF-8", $1)); } my $boundary = "====" . time() . "===="; -- 1.7.10.4