From 09ab77c85799f0e06b8eb366b5e9422e0b5fff24 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 31 Mar 2025 08:28:09 +0000 Subject: [PATCH] Bug 39485: Fix wide character in print-warn in opac-export Similar change in intranet counterpart: catalogue/export. Test plan: Verify no warning anymore when using ris or isbd when record contains specific Unicode character(s). Signed-off-by: Magnus Enger I could not trigger "Wide character" for RIS in the OPAC, but for ISBD I can see it removes that warning. Signed-off-by: David Cook --- catalogue/export.pl | 2 +- opac/opac-export.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/catalogue/export.pl b/catalogue/export.pl index cd81ec3b53..a7c77c62f1 100755 --- a/catalogue/export.pl +++ b/catalogue/export.pl @@ -70,7 +70,7 @@ if ( $op eq "export" ) { ( $error, $marc ) = marc2marc( $marc, 'marcstd', C4::Context->preference('marcflavour') ); $format = "marcstd"; } - if ( $format =~ /utf8/ or $format =~ /marcstd/ ) { + if ( $format ne 'marc8' ) { binmode STDOUT, ':encoding(UTF-8)'; } print $query->header( diff --git a/opac/opac-export.pl b/opac/opac-export.pl index 3cb829b453..8a2622a36b 100755 --- a/opac/opac-export.pl +++ b/opac/opac-export.pl @@ -162,6 +162,7 @@ if ($error) { print $query->escapeHTML("$error"); print $query->end_html(); } else { + binmode STDOUT, ':encoding(UTF-8)' if $format ne 'marc8'; if ( $format eq 'marc8' ) { print $query->header( -type => 'application/marc', @@ -181,7 +182,6 @@ if ($error) { -attachment => "$file_pre$file_id.$format" ); } else { - binmode STDOUT, ':encoding(UTF-8)'; print $query->header( -type => 'application/octet-stream', -charset => 'utf-8', -- 2.39.5