From 0cce5e613f3d3bc0e5f7d24b92423fac67e511ac Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 27 Apr 2021 10:45:53 +0200 Subject: [PATCH] Bug 28234: Fix encoding issues in build_sample_biblio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Found when working on bug 28230. The tests generated a warning no mapping found for [0x2764] at position 4 in hell❤️ g0=ASCII_DEFAULT g1=EXTENDED_LATIN at /usr/share/perl5/MARC/Charset.pm line 308. The MARC::Record built by TestBuilder did not set the leader and unicode flag --- t/lib/TestBuilder.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm index 26de949fb38..cb0f327d0a9 100644 --- a/t/lib/TestBuilder.pm +++ b/t/lib/TestBuilder.pm @@ -155,7 +155,14 @@ sub build_sample_biblio { my $marcflavour = C4::Context->preference('marcflavour'); my $record = MARC::Record->new(); + + if ( $marcflavour eq 'MARC21' ) { + $record->leader(' nz a22 o 4500'); + C4::Charset::SetMarcUnicodeFlag( $record, 'MARC21' ); + } + my ( $tag, $subfield ) = $marcflavour eq 'UNIMARC' ? ( 200, 'a' ) : ( 245, 'a' ); + $record->append_fields( MARC::Field->new( $tag, ' ', ' ', $subfield => $title ), ); -- 2.20.1