LP856567: Mark HTML report output as Unicode-encoded
authorDan Scott <dscott@laurentian.ca>
Thu, 22 Sep 2011 16:51:22 +0000 (12:51 -0400)
committerMike Rylander <mrylander@gmail.com>
Wed, 28 Sep 2011 19:40:22 +0000 (15:40 -0400)
Non-ASCII characters in report ouput that has been generated in HTML
format appears to be corrupted when viewed in a browser. This can be
manually corrected by switching the "Encoding" browser option, but it
would be better to include <meta charset='utf-8'> in the output HTML to
tell the browser directly.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Mike Rylander <mrylander@gmail.com>

Open-ILS/src/reporter/clark-kent.pl

index d618782..e8cf88d 100755 (executable)
@@ -443,6 +443,7 @@ sub build_html {
        print $index <<"        HEADER";
 <html>
        <head>
+               <meta charset='utf-8'>
                <title>$$r{report}{name}</title>
                <style>
                        table { border-collapse: collapse; }
@@ -474,7 +475,7 @@ sub build_html {
        push @links, "<a class='dim' href='report-data.html.debug.html'>Debugging Info</a>";
 
        my $debug = new FileHandle (">$file.debug.html") or die "Cannot write to '$file.debug.html'";
-       print $debug "<html><head><title>DEBUG: $$r{report}{name}</title></head><body>";
+       print $debug "<html><head><meta charset='utf-8'><title>DEBUG: $$r{report}{name}</title></head><body>";
 
        {       no warnings;
                print $debug '<h1>Generated SQL</h1><pre>' . $r->{resultset}->toSQL() . "</pre><a href='$file'>Back to output index</a><hr/>";
@@ -496,7 +497,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'";
-               print $raw "<html><head><title>$$r{report}{name}</title>";
+               print $raw "<html><head><meta charset='utf-8'><title>$$r{report}{name}</title>";
 
                print $raw <<'          CSS';
                        <style>