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=78d3d4e0347178651974f33549039d3058f9661f;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 dc61533738..a713a33030 100755 --- a/Open-ILS/src/reporter/clark-kent.pl +++ b/Open-ILS/src/reporter/clark-kent.pl @@ -474,7 +474,7 @@ sub build_html { my $file = shift; 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} ); @@ -545,7 +545,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'; @@ -568,7 +568,7 @@ sub build_html { print $raw ''; - $raw->close; + close($raw); } # Time for a pie chart @@ -612,7 +612,7 @@ sub build_html { # and that's it! print $index ''; - $index->close; + close($index); } sub draw_pie {