From 25d88b5e4ef12daa1a6c4541e7c8edcfefeec803 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 24 May 2023 11:21:26 +0000 Subject: [PATCH] Bug 33404: (bug 19436 follow-up) Save the original encoded record This patch restores previous behavior of storing the record as received from the source with the original encoding. We store the encoding in the DB as well, but save the record converted to UTF8 - this means that when we try to display and convert to UTF8 again, we mangle the record While providing a test plan, it requires a MARC8 Authority source, and I cannot locate an open one. This change can be verified by reading the code. There are no unit tests for Z3950SearchAuth, but it does too much and requires many mocks, this is a small fix to a reversion and should be able to move forward. To test: 1 - Search a Z39 authority server that has MARC8 (or non utf8) records 2 - Find a record with diacritics in the record 3 - Import it 4 - Note diacritics are mangled 5 - Apply patch, restart_all 6 - Perform a new Z3950 search (to ensure record is not already in reservoir) 7 - Find a record with diacritics 8 - Import it 9 - Note diacritics correctly encoded --- C4/Breeding.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index efc9029f48..bd9a1620be 100644 --- a/C4/Breeding.pm +++ b/C4/Breeding.pm @@ -596,7 +596,9 @@ sub Z3950SearchAuth { $heading = GetAuthorizedHeading({ record => $marcrecord }); - my $breedingid = ImportBreedingAuth( $marcrecord, $serverhost[$k], $encoding[$k], $heading ); + my $import_record = MARC::Record->new_from_usmarc( $marcdata ); + my $breedingid = ImportBreedingAuth( $import_record, $serverhost[$k], $encoding[$k], $heading ); + my %row_data; $row_data{server} = $servers[$k]->{'servername'}; $row_data{breedingid} = $breedingid; -- 2.30.2