From d263fe96ddc88278771f90914595f35891c3da56 Mon Sep 17 00:00:00 2001 From: David Schmidt Date: Tue, 4 Feb 2025 11:48:07 +0100 Subject: [PATCH] Bug 39023: Fix encoding in CSV output file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sponsored-by: Styrian State Library Testplan: I) Prepare overdue entry (intranet): 0) Create a patron account with surname Höfler 1) Check if in Patron category administration the overdue column is YES for his code 2) In Tools -> Notice triggers define first delay = 7, letter Overdue notice. Nothing for second and third 3) Check if Tools -> Notices and slips, code overdue is available 4) checkout a book with a retard more than 7 days. 5) Check if Adminstration -> Defining circulation and fine rules for all libraries has fine rules for his patron category, item type book. II) Before applying the patch 0) Run misc/cronjobs/overdue_notices.pl -v -test -list-all -csv="overdue_old.csv" 1) Validate the characters are in Latin1 encoding. (hexdump -C overdue.csv|less) ö => "f6" III) After applying the patch 0) Run misc/cronjobs/overdue_notices.pl -v -test -list-all -csv="overdue_fixed.csv" 1) Validate the characters are in UTF-8 encoding. (hexdump -C overdue_fixed.csv|less) ö => "c3 b6 --- misc/cronjobs/overdue_notices.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index 3a70377..27de141 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -419,7 +419,7 @@ if ( defined $csvfilename ) { if ( $csvfilename eq '' ) { $csv_fh = *STDOUT; } else { - open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!"; + open $csv_fh, ">:encoding(UTF-8)", $csvfilename or die "unable to open $csvfilename: $!"; } if ( $csv->combine(qw(name surname address1 address2 zipcode city country email phone cardnumber itemcount itemsinfo branchname letternumber)) ) { print $csv_fh $csv->string, "\n"; -- 2.39.5