From f01e616a72d839215d36ff8e6e32c8096ce2a262 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 4 Dec 2014 13:13:30 +0100 Subject: [PATCH] Bug 11944: Fix problems introduced by bug 11515 The game continue... Patch for bug 11515 introduced regression on this patch set. To reproduce: search with utf8 characters at the opac Test plan: Verify that the issue described on bug 11515 is still fixed and that no regression is found at the OPAC. Note that I am pretty sure this patch is not enough. Signed-off-by: Tomas Cohen Arazi --- opac/opac-detail.pl | 4 ++-- opac/opac-search.pl | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 4072138257..b8cd194a9d 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -168,13 +168,13 @@ if ($session->param('busc')) { if ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|total|offset|offsetSearch|next|previous|count|expand|scan)/) { if (defined($arrParamsBusc->{$_})) { $pasarParams .= '&' if ($j); - $pasarParams .= $_ . '=' . uri_escape( $arrParamsBusc->{$_} ); + $pasarParams .= $_ . '=' . Encode::decode('UTF-8', uri_escape_utf8( $arrParamsBusc->{$_} )); $j++; } } else { for my $value (@{$arrParamsBusc->{$_}}) { $pasarParams .= '&' if ($j); - $pasarParams .= $_ . '=' . uri_escape($value); + $pasarParams .= $_ . '=' . Encode::decode('UTF-8', uri_escape_utf8($value)); $j++; } } diff --git a/opac/opac-search.pl b/opac/opac-search.pl index f5527031f4..b0feaeb8cd 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -356,7 +356,7 @@ for (keys %$params) { my @pasarParam = $cgi->param($_); for my $paramValue(@pasarParam) { $pasarParams .= '&' if ($j > 0); - $pasarParams .= $_ . '=' . uri_escape($paramValue); + $pasarParams .= $_ . '=' . uri_escape_utf8($paramValue); $j++; } } @@ -544,10 +544,10 @@ if ($tag) { ($error, $results_hashref, $facets) = C4::Search::pazGetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan); }; } else { - $pasarParams .= '&query=' . uri_escape($query); - $pasarParams .= '&count=' . uri_escape($results_per_page); - $pasarParams .= '&simple_query=' . uri_escape($simple_query); - $pasarParams .= '&query_type=' . uri_escape($query_type) if ($query_type); + $pasarParams .= '&query=' . uri_escape_utf8($query); + $pasarParams .= '&count=' . uri_escape_utf8($results_per_page); + $pasarParams .= '&simple_query=' . uri_escape_utf8($simple_query); + $pasarParams .= '&query_type=' . uri_escape_utf8($query_type) if ($query_type); eval { ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$itemtypes,$query_type,$scan,1); }; @@ -699,12 +699,12 @@ for (my $i=0;$i<@servers;$i++) { my $j = 0; foreach (@newresults) { my $bibnum = ($_->{biblionumber})?$_->{biblionumber}:0; - $pasarParams .= uri_escape($bibnum) . ','; + $pasarParams .= uri_escape_utf8($bibnum) . ','; $j++; last if ($j == $results_per_page); } chop $pasarParams if ($pasarParams =~ /,$/); - $pasarParams .= '&total=' . uri_escape( int($total) ) if ($pasarParams !~ /total=(?:[0-9]+)?/); + $pasarParams .= '&total=' . uri_escape_utf8( int($total) ) if ($pasarParams !~ /total=(?:[0-9]+)?/); if ($pasarParams) { my $session = get_session($cgi->cookie("CGISESSID")); $session->param('busc' => $pasarParams); -- 2.39.5