From 40ca640287f39185b023be03be923d17c565756d Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 24 May 2023 14:57:46 +0000 Subject: [PATCH] Bug 33404: Alternative approach Content-Type: text/plain; charset=utf-8 Work in progress --- C4/Breeding.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index efc9029f48..7a27575357 100644 --- a/C4/Breeding.pm +++ b/C4/Breeding.pm @@ -478,9 +478,6 @@ sub ImportBreedingAuth { my $controlnumber = $marcrecord->field('001')->data; - # Normalize the record so it doesn't have separated diacritics - SetUTF8Flag($marcrecord); - $searchbreeding->execute($controlnumber,$heading); my ($breedingid) = $searchbreeding->fetchrow; @@ -588,6 +585,13 @@ sub Z3950SearchAuth { $marcrecord->encoding('UTF-8'); } else { ( $marcrecord, $charset_result, $charset_errors ) = MarcToUTF8Record( $marcdata, $marc_type, $encoding[$k] ); + if( !@$charset_errors ) { + $marcrecord->encoding('UTF-8'); + SetUTF8Flag($marcrecord); + } else { + require Data::Dumper; warn Data::Dumper::Dumper( 'Z3950SearchAuth conversion error', $charset_result, $charset_errors ); + next; # skip this one + } } my $heading; my $heading_authtype_code; @@ -596,7 +600,8 @@ sub Z3950SearchAuth { $heading = GetAuthorizedHeading({ record => $marcrecord }); - my $breedingid = ImportBreedingAuth( $marcrecord, $serverhost[$k], $encoding[$k], $heading ); + my $breedingid = ImportBreedingAuth( $marcrecord, $serverhost[$k], 'UTF-8', $heading ); + my %row_data; $row_data{server} = $servers[$k]->{'servername'}; $row_data{breedingid} = $breedingid; -- 2.30.2