Bug 11944: decode uri_unescape data
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 23 Jul 2014 15:03:51 +0000 (17:03 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 13 Jan 2015 16:07:43 +0000 (13:07 -0300)
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 <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
catalogue/search.pl
opac/opac-search.pl

index 26b3702..d25e19e 100755 (executable)
@@ -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;
     }
index d04f436..f552703 100755 (executable)
@@ -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;
 }