Bug 11944: Fix encoding issue on search history
authorJonathan Druart <jonathan.druart@biblibre.com>
Thu, 8 May 2014 10:34:24 +0000 (12:34 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 13 Jan 2015 16:07:28 +0000 (13:07 -0300)
Newly introduced by patches from bug 10807, the string was decoded
before to be stored in session.

To reproduce:
Enable history search
Go at the OPAC and log out
Search for something with utf-8
Go on your search history
The search description should be correctly encoded

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Search/History.pm

index 4330692..9640476 100644 (file)
@@ -37,8 +37,8 @@ sub add {
 sub add_to_session {
     my ($params) = @_;
     my $cgi = $params->{cgi};
-    my $query_desc = Encode::decode_utf8( $params->{query_desc} ) || "unknown";
-    my $query_cgi  = Encode::decode_utf8( $params->{query_cgi} )  || "unknown";
+    my $query_desc = $params->{query_desc} || "unknown";
+    my $query_cgi  = $params->{query_cgi} || "unknown";
     my $total      = $params->{total};
     my $type       = $params->{type}                              || 'biblio';
 
@@ -152,7 +152,7 @@ sub set_to_session {
     my $session = C4::Auth::get_session($sessionID);
     return () unless $session;
     $session->param( 'search_history',
-        uri_escape_utf8( encode_json($search_history) ) );
+        uri_escape( encode_json($search_history) ) );
 }
 
 1;