[Koha-patches] [PATCH] Bug 6145: ModBiblio : double encoding items information

Julian Maurice julian.maurice at biblibre.com
Fri Apr 8 14:41:33 CEST 2011


From: Henri-Damien LAURENT <henridamien.laurent at biblibre.com>

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



More information about the Koha-patches mailing list