[Koha-patches] [PATCH] Bug 3226 - Extended characters inconsistantly displayed

LAURENT Henri-Damien henridamien.laurent at biblibre.com
Mon Jun 22 13:43:54 CEST 2009


hi
Why not use preferredRecordSyntax=XML ?
rather than hardcoding get('xml')
I have never had this problem.
But it seems to me that adding a preference to connection would be safer 
than hardcoding a get param.
-- 
Henri-Damien LAURENT

Frédéric Demians a écrit :
> When displayed on result page, some UNIMARC biblio
> records are marc8 to utf8 converted for whatever
> reason! It appears that iso2709 records in Zebra can't
> always properly by used to construct MARC::Record.
> This patch ask Zebra to return xml record rather than
> iso2709 and use it to create MARC::Record (like
> C4::GetMarcBiblio).
> ---
>  C4/Search.pm |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/C4/Search.pm b/C4/Search.pm
> index 13f504f..195d802 100644
> --- a/C4/Search.pm
> +++ b/C4/Search.pm
> @@ -461,7 +461,7 @@ sub getRecords {
>  
>                      # not an index scan
>                      else {
> -                        $record = $results[ $i - 1 ]->record($j)->raw();
> +                        $record = $results[ $i - 1 ]->record($j)->get('xml');
>  
>                          # warn "RECORD $j:".$record;
>                          $results_hash->{'RECORDS'}[$j] = $record;
> @@ -1235,9 +1235,11 @@ sub searchResults {
>      }
>  
>  	my $marcflavour = C4::Context->preference("marcflavour");
> +	MARC::File::XML->default_record_format( $marcflavour );
>      # loop through all of the records we've retrieved
>      for ( my $i = $offset ; $i <= $times - 1 ; $i++ ) {
> -        my $marcrecord = MARC::File::USMARC::decode( $marcresults[$i] );
> +        my $marcrecord = 
> +          MARC::Record::new_from_xml( $marcresults[$i], "utf8", $marcflavour );
>          my $oldbiblio = TransformMarcToKoha( $dbh, $marcrecord, '' );
>          $oldbiblio->{subtitle} = C4::Biblio::get_koha_field_from_marc('bibliosubtitle', 'subtitle', $marcrecord, '');
>          $oldbiblio->{result_number} = $i + 1;
>   




More information about the Koha-patches mailing list