[Koha-patches] [PATCH] Bug 15818 - OPAC search with utf-8 characters and without results generates encoding error

Dobrica Pavlinusic dpavlin at rot13.org
Mon Feb 15 15:30:49 CET 2016


When searching for something in OPAC which doesn't result in any results but have utf-8
characters in search string we get following encoding error:

Cannot decode string with wide characters at /usr/lib/i386-linux-gnu/perl5/5.20/Encode.pm line 215.

This is because we are trying to decode string which is allready correctly
marked as utf-8.

Test scenario:

1) enter search string with utf-8 characters in opac which doesn't
   return any results
2) verify that you get application error
3) apply this patch
4) re-run query and verify that errror is gone
---
 opac/opac-search.pl | 1 -
 1 file changed, 1 deletion(-)

diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index 8157e7d..6a9403c 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -890,7 +890,6 @@ for (my $i=0;$i<@servers;$i++) {
             if ($nohits and $nohits=~/{QUERY_KW}/){
                 # extracting keywords in case of relaunching search
                 (my $query_kw=$query_desc)=~s/ and|or / /g;
-                $query_kw = Encode::decode_utf8($query_kw);
                 my @query_kw=($query_kw=~ /([-\w]+\b)(?:[^,:]|$)/g);
                 $query_kw=join('+', at query_kw);
                 $nohits=~s/{QUERY_KW}/$query_kw/g;
-- 
2.1.4



More information about the Koha-patches mailing list