Bug 11944: Fix encoding issue on searching

The search patch should fix non-latin character searches.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.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>
This commit is contained in:
Jonathan Druart 2014-03-17 15:13:27 +01:00 committed by Tomas Cohen Arazi
parent df74fe9be8
commit 33d1281ef4
1 changed files with 3 additions and 9 deletions

View File

@ -36,7 +36,6 @@ use URI::Escape;
use Business::ISBN;
use MARC::Record;
use MARC::Field;
use Encode qw( decode is_utf8 );
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG);
# set the version for version checking
@ -1931,6 +1930,8 @@ sub searchResults {
: $bibliotag < 10
? GetFrameworkCode($marcrecord->field($bibliotag)->data)
: GetFrameworkCode($marcrecord->subfield($bibliotag,$bibliosubf));
SetUTF8Flag($marcrecord);
my $oldbiblio = TransformMarcToKoha( $dbh, $marcrecord, $fw );
$oldbiblio->{subtitle} = GetRecordValue('subtitle', $marcrecord, $fw);
$oldbiblio->{result_number} = $i + 1;
@ -1981,12 +1982,7 @@ sub searchResults {
if($marcrecord->field($1)){
my @repl = $marcrecord->field($1)->subfield($2);
my $subfieldvalue = $repl[$i];
if (! Encode::is_utf8($subfieldvalue)) {
$subfieldvalue = Encode::decode('UTF-8', $subfieldvalue);
}
$newline =~ s/\[$tag\]/$subfieldvalue/g;
$newline =~ s/\[$tag\]/$subfieldvalue/g;
}
}
$newsummary .= "$newline\n";
@ -2229,8 +2225,6 @@ sub searchResults {
}
# XSLT processing of some stuff
SetUTF8Flag($marcrecord);
warn $marcrecord->as_formatted if $DEBUG;
my $interface = $search_context eq 'opac' ? 'OPAC' : '';
if (!$scan && C4::Context->preference($interface . "XSLTResultsDisplay")) {
$oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $interface."XSLTResultsDisplay", 1, \@hiddenitems);