From a5ee0f3d70651fbdbcec1ed8cb47b0aed9ec752f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 18 Aug 2014 17:33:32 +0200 Subject: [PATCH] Bug 11944: Fix suggestion at the OPAC for perl v5.10 Without this patch and using Perl v5.10, on adding a suggestion at the OPAC, the script explodes with the following error: "cannot decode string with wide characters". With this patch, all is fine using Perl v5.10 and v5.18. Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- opac/opac-suggestions.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index c4b13594c3..701e431b8f 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -19,6 +19,7 @@ use strict; use warnings; use CGI qw ( -utf8 ); +use Encode qw( encode ); use C4::Auth; # get_template_and_user use C4::Members; use C4::Branch; @@ -91,7 +92,8 @@ if ( $op eq "add_confirm" ) { else { my $scrubber = C4::Scrubber->new(); foreach my $suggest (keys %$suggestion){ - $suggestion->{$suggest} = $scrubber->scrub($suggestion->{$suggest}); + # Don't know why the encode is needed for Perl v5.10 here + $suggestion->{$suggest} = Encode::encode("utf8", $scrubber->scrub($suggestion->{$suggest}) ); } $suggestion->{suggesteddate} = dt_from_string; $suggestion->{branchcode} = $input->param('branchcode') || C4::Context->userenv->{"branch"}; -- 2.39.5