From 43f245e9891c8983b801527a993144b26c7cab7c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 17 Mar 2014 15:13:27 +0100 Subject: [PATCH] Bug 11944: Fix encoding issue on searching --- C4/Output.pm | 2 ++ C4/Search.pm | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/C4/Output.pm b/C4/Output.pm index 5dc03d7..9df21fc 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -28,6 +28,7 @@ package C4::Output; use strict; #use warnings; FIXME - Bug 2505 +use Encode qw( encode ); use URI::Escape; use C4::Context; @@ -312,6 +313,7 @@ sub output_with_http_headers { # We need to fix the encoding as it comes out of the database, or when we pass the variables to templates $data =~ s/\&\;amp\; /\&\; /g; + Encode::encode('UTF-8', $data); print $query->header($options), $data; } diff --git a/C4/Search.pm b/C4/Search.pm index c2e9d9a..9717fbd 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -493,6 +493,7 @@ sub getRecords { # not an index scan else { $record = $results[ $i - 1 ]->record($j)->raw(); + Encode::decode('UTF-8', $record ); # warn "RECORD $j:".$record; $results_hash->{'RECORDS'}[$j] = $record; } @@ -519,6 +520,8 @@ sub getRecords { next; } + Encode::decode('UTF-8', $marc_record); + my @used_datas = (); foreach my $tag ( @{ $facet->{tags} } ) { @@ -720,6 +723,7 @@ sub pazGetRecords { for (my $i = 0; $i < $count; $i++) { # FIXME -- may need to worry about diacritics here my $rec = $paz->record($recid, $i); + Encode::decode('UTF-8', $rec ); push @{ $result_group->{'RECORDS'} }, $rec; } -- 1.7.10.4