From 6fe294e731dd76eb3f37e6df570be0398dae2519 Mon Sep 17 00:00:00 2001 From: Mark Hofstetter Date: Mon, 19 Oct 2020 17:28:19 +0000 Subject: [PATCH] Bug 26601: Add utf8 encoding to text output of overdue_notices.pl This patch sets the UTF8 encoding for output of overdue_notices.pl when outputting to txt. To test: 0/ Check out an item with due date yesterday (use specify due date) 1/ Create ODUE text with utf8 encoded characters, chinese characters, umlauts etc /cgi-bin/koha/tools/letter.pl?op=add_form&module=circulation&code=ODUE 2/ Run perl overdue_notices.pl -text ./ 3/ Verify encoding in the generated text file is incorrect 4/ Apply patch and repeat 2/ 3/ Confirm text now inludes properly encoded characters Sponsored-by: Styrian State Library Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer With German umlauts on my system the editor still showed the characters correctly (probably guessing the right encoding). Using Chinese made the problem visible. Signed-off-by: Jonathan Druart (cherry picked from commit 28d20b92be91ae509a7f71586ada2535d3c2007d) Signed-off-by: Lucas Gass (cherry picked from commit 61362fd0431c6bc439507cc4e49c0810a704f925) Signed-off-by: Aleisha Amohia (cherry picked from commit 8cd87230b188d6677b58d222049919dcd9467401) Signed-off-by: Victor Grousset/tuxayo --- 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 8440f3a3ba..9147171976 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -439,7 +439,7 @@ elsif ( defined $text_filename ) { $fh = *STDOUT; } else { my $today = DateTime->now(time_zone => C4::Context->tz ); - open $fh, ">",File::Spec->catdir ($text_filename,"notices-".$today->ymd().".txt"); + open $fh, ">:encoding(UTF-8)",File::Spec->catdir ($text_filename,"notices-".$today->ymd().".txt"); } } -- 2.39.5