From 475636656784e62721c3abdd910f2b10b95ba7fa Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 5 Sep 2019 14:32:48 +0200 Subject: [PATCH] Bug 23542: fix SRU import ending issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When importing records from a SRU server, the diacritics have bad encoding. I reproduce with BNF server so it may be a UNIMARC issue. Looks like this does not affect autorities import for SRU server. In C4::Breeding::_handle_one_result(), in case of a Z39.50 server, when creating MARC::Record MarcToUTF8Record() is called which calls SetMarcUnicodeFlag(). This ensures that leader indicates UTF-8 encoding. Looking at MARC::Record->encoding() shows that encoding depends on leader even for UNIMARC. So this patch adds a call to SetMarcUnicodeFlag() in cas of a SRU server in C4::Breeding::_handle_one_result(). Test plan : 1) Use a UNIMARC database 2) Configure a connexion to a UNIMARC SRU, for example BNF, see https://doc.biblibre.com/koha/autour_de_koha/serveurs_z3950_sru#serveur_de_la_bnf 3) Go to cataloguing module 4) Click on 'New from Z39.50/SRU' 5) Choose only the SRU target 6) Search for ISBN 2266072889 7) Confirm you see good encoding : diacritic on 'a' of title 'Strate-a-gemmes' 8) Click on 'Marc preview' 9) Confirm you see good encoding 10) Click import 11) Confirm you see good encoding 12) Check SRU connexion on a MARC21 database is still OK Signed-off-by: Séverine QUEUNE Signed-off-by: Séverine QUEUNE --- C4/Breeding.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index 8f3e4a8..da89f6a 100644 --- a/C4/Breeding.pm +++ b/C4/Breeding.pm @@ -291,8 +291,8 @@ sub _handle_one_result { my $raw= $zoomrec->raw(); my $marcrecord; if( $servhref->{servertype} eq 'sru' ) { - $marcrecord= MARC::Record->new_from_xml( $raw, 'UTF-8', - $servhref->{syntax} ); + $marcrecord = MARC::Record->new_from_xml( $raw, 'UTF-8', $servhref->{syntax} ); + SetMarcUnicodeFlag( $marcrecord, C4::Context->preference("marcflavour") ); } else { ($marcrecord) = MarcToUTF8Record($raw, C4::Context->preference('marcflavour'), $servhref->{encoding} // "iso-5426" ); #ignores charset return values } -- 2.7.4