From b1f099d787b8b552942a51f01fd23cf1b5c73305 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. --- 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 7d15bec..b0a10b4 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; @@ -88,7 +89,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'}=C4::Dates->today; $$suggestion{'branchcode'}= $input->param('branch') || C4::Context->userenv->{"branch"}; -- 2.0.0.rc2