Bug 11944: FIX Error on editing an authority
authorJonathan Druart <jonathan.druart@biblibre.com>
Mon, 7 Apr 2014 11:58:38 +0000 (13:58 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 13 Jan 2015 16:07:11 +0000 (13:07 -0300)
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>
C4/AuthoritiesMarc.pm
C4/Biblio.pm

index e983159..911532c 100644 (file)
@@ -277,6 +277,8 @@ sub SearchAuthorities {
             next;
         }
 
+        SetUTF8Flag( $authrecord );
+
         my $authid=$authrecord->field('001')->data();
         my %newline;
         $newline{authid} = $authid;
index 290efec..8d62a61 100644 (file)
@@ -23,7 +23,7 @@ use strict;
 use warnings;
 use Carp;
 
-use Encode qw( decode );
+use Encode qw( decode is_utf8 );
 use MARC::Record;
 use MARC::File::USMARC;
 use MARC::File::XML;
@@ -2470,11 +2470,9 @@ sub TransformHtmlToMarc {
     foreach my $param_name ( keys %$cgi_params ) {
         if ( $param_name =~ /^tag_/ ) {
             my $param_value = $cgi_params->{$param_name};
-            if ( $param_value = Encode::decode('UTF-8', $param_value) ) {
-                $cgi_params->{$param_name} = $param_value;
+            unless ( Encode::is_utf8( $param_value ) ) {
+                $cgi_params->{$param_name} = Encode::decode('UTF-8', $param_value );
             }
-
-            # FIXME - need to do something if string is not valid UTF-8
         }
     }