From 5e0b5671bf44aa8b92d7e37ac5992d88b3fc84a6 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Wed, 23 Jul 2014 17:03:51 +0200 Subject: [PATCH] Bug 11944: decode uri_unescape data This data is passed into form so it needs to be correctly marked as utf-8 if we want form submit to work correctly This change fixes sort issues which use form submit. Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- catalogue/search.pl | 4 ++-- opac/opac-search.pl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index 26b3702..d25e19e 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -414,7 +414,7 @@ if ($indexes[0] && (!$indexes[1] || $params->{'scan'})) { } # an operand can be a single term, a phrase, or a complete ccl query -my @operands = map uri_unescape($_), $cgi->param('q'); +my @operands = map Encode::decode_utf8( uri_unescape($_) ), $cgi->param('q'); # limits are use to limit to results to a pre-defined category such as branch or language my @limits = map uri_unescape($_), $cgi->param('limit'); @@ -498,7 +498,7 @@ for my $this_cgi ( split('&',$query_cgi) ) { $this_cgi =~ m/(.*?)=(.*)/; my $input_name = $1; my $input_value = $2; - push @query_inputs, { input_name => $input_name, input_value => $input_value }; + push @query_inputs, { input_name => $input_name, input_value => Encode::decode_utf8( uri_unescape( $input_value ) ) }; if ($input_name eq 'idx') { $scan_index_to_use = $input_value; # unless $scan_index_to_use; } diff --git a/opac/opac-search.pl b/opac/opac-search.pl index d04f436..f552703 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -477,7 +477,7 @@ sub _input_cgi_parse { for my $this_cgi ( split('&',shift) ) { next unless $this_cgi; $this_cgi =~ /(.*?)=(.*)/; - push @elements, { input_name => $1, input_value => uri_unescape($2) }; + push @elements, { input_name => $1, input_value => Encode::decode_utf8( uri_unescape($2) ) }; } return @elements; } -- 2.1.0