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
   <url>/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 <martin.renvoize@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
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 <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 28d20b92be)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 61362fd043)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

(cherry picked from commit 8cd87230b1)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
This commit is contained in:
Mark Hofstetter 2020-10-19 17:28:19 +00:00 committed by Victor Grousset/tuxayo
parent a25696fb12
commit 6fe294e731
1 changed files with 1 additions and 1 deletions

View File

@ -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");
}
}