From ca14f04902978c44138734f9ce099afb56656f08 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Mon, 15 Nov 2010 19:18:37 +0100 Subject: [PATCH] Bug 6145: ModBiblio : double encoding items information diacritics would be double encoded when using ModBiblio multiple times on the same biblio. this patch fixes that. --- C4/Biblio.pm | 33 +++++++++++++++++---------------- 1 files changed, 17 insertions(+), 16 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 135dd91..3cc7fb1 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -317,22 +317,23 @@ sub ModBiblio { # strange, I (Paul P.) searched more than 1 day to understand what happends # but could only solve the problem this way... my @fields = $oldRecord->field($itemtag); - foreach my $fielditem (@fields) { - my $field; - foreach ( $fielditem->subfields() ) { - # re-encode the subfield only if it isn't already in utf-8. - my ($tag, $value) = @$_; - $tag = Encode::encode('utf-8', $tag) unless utf8::is_utf8($tag); - $value = Encode::encode('utf-8', $value) unless utf8::is_utf8($value); - - if ($field) { - $field->add_subfields( $tag => $value ); - } else { - $field = MARC::Field->new( "$itemtag", '', '', $tag => $value ); - } - } - $record->append_fields($field); - } + $record->append_fields(@fields); +# foreach my $fielditem (@fields) { +# my $field; +# foreach ( $fielditem->subfields() ) { +# # re-encode the subfield only if it isn't already in utf-8. +# my ($tag, $value) = @$_; +# $tag = Encode::encode('utf-8', $tag) unless utf8::is_utf8($tag); +# $value = Encode::encode('utf-8', $value) unless utf8::is_utf8($value); +# +# if ($field) { +# $field->add_subfields( $tag => $value ); +# } else { +# $field = MARC::Field->new( "$itemtag", '', '', $tag => $value ); +# } +# } +# $record->append_fields($field); +# } foreach my $field ($record->fields()) { if (! $field->is_control_field()) { -- 1.7.4.1