From c9226023eefdd807ceffa67e4f4bf5f82ffbcf40 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 7 Apr 2014 13:58:38 +0200 Subject: [PATCH] Bug 11944: FIX Error on editing an authority Signed-off-by: Paola Rossi Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Dobrica Pavlinusic --- C4/AuthoritiesMarc.pm | 2 ++ C4/Biblio.pm | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 95fe33a..8fea994 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -277,6 +277,8 @@ sub SearchAuthorities { next; } + SetUTF8Flag( $authrecord ); + my $authid=$authrecord->field('001')->data(); my %newline; $newline{authid} = $authid; diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 04895f6..45cfbc5 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -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; @@ -2484,11 +2484,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 } } -- 1.7.2.5