From a938dca0ae104a347594c882658e875a81db07a2 Mon Sep 17 00:00:00 2001 From: Dan Scott <dscott@laurentian.ca> Date: Tue, 17 Nov 2015 12:11:19 -0500 Subject: [PATCH] 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 <dscott@laurentian.ca> --- Open-ILS/src/reporter/clark-kent.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/reporter/clark-kent.pl b/Open-ILS/src/reporter/clark-kent.pl index 72edf1855e..d31ede610d 100755 --- a/Open-ILS/src/reporter/clark-kent.pl +++ b/Open-ILS/src/reporter/clark-kent.pl @@ -486,6 +486,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} ); @@ -556,7 +557,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 "<html><head><meta charset='utf-8'><title>$$r{report}{name}</title>"; print $raw <<' CSS'; @@ -582,7 +583,7 @@ sub build_html { } print $raw '</body></html>'; - $raw->close; + close($raw); } # Time for a pie chart @@ -626,7 +627,7 @@ sub build_html { # and that's it! print $index '</body></html>'; - $index->close; + close($index); } sub draw_pie { -- 2.11.0