From: Dan Scott Date: Tue, 17 Nov 2015 17:11:19 +0000 (-0500) Subject: Fix encoding issues in HTML report files X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e66988794349676af3adbd89f93c4f4a0295a9d9;p=contrib%2FConifer.git Fix encoding issues in HTML report files Opening the files without the utf-8 encoding pragma resulted in corrupted UTF8 output. Signed-off-by: Dan Scott --- diff --git a/Open-ILS/src/reporter/clark-kent.pl b/Open-ILS/src/reporter/clark-kent.pl index 80a320ca75..06dc44ef76 100755 --- a/Open-ILS/src/reporter/clark-kent.pl +++ b/Open-ILS/src/reporter/clark-kent.pl @@ -448,6 +448,7 @@ sub build_html { my $r = shift; my $index = new FileHandle (">$file") or die "Cannot write to '$file'"; + open(my $index, ">:encoding(utf-8)", "$file") or die "Cannot write to '$file'"; my $tdata = OpenSRF::Utils::JSON->JSON2perl( $r->{report}->{template}->{data} ); @@ -518,7 +519,7 @@ sub build_html { if ($r->{html_format}) { # create the raw output html file - my $raw = new FileHandle (">$file.raw.html") or die "Cannot write to '$file.raw.html'"; + open(my $raw, ">:encoding(utf-8)", "$file.raw.html") or die "Cannot write to '$file.raw.html'"; print $raw "$$r{report}{name}"; print $raw <<' CSS'; @@ -541,7 +542,7 @@ sub build_html { print $raw ''; - $raw->close; + close($raw); } # Time for a pie chart @@ -573,7 +574,7 @@ sub build_html { # and that's it! print $index ''; - $index->close; + close($index); } sub draw_pie {