]> granicus.if.org Git - pgbadger/commitdiff
Encode html output of queries into UTF8 to avoid message "Wide character
authorGilles Darold <gilles@darold.net>
Fri, 21 Dec 2018 08:21:53 +0000 (09:21 +0100)
committerGilles Darold <gilles@darold.net>
Fri, 21 Dec 2018 08:21:53 +0000 (09:21 +0100)
in print". Thanks to Colin 't Hart for the report.

pgbadger

index 8e791890cba255cfe16d1b52e3a0a0ac073bb4d5..8663c2a33d9ee225097e1474d610211c2d76a761 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -50,6 +50,7 @@ use IO::Pipe;
 use FileHandle;
 use Socket;
 use constant EBCDIC => "\t" ne "\011";
+use Encode qw(encode decode);
 
 $VERSION = '10.1';
 
@@ -11406,6 +11407,7 @@ sub show_error_as_html
                                $details .= "<b>Code:</b> $error_info{$k}{sqlstate}[$i]\n";
                        }
                        $details =~ s/<br\/>$//s;
+                       $info = encode('UTF-8', $info);
                        print $fh qq{
                                                                <dt><span class="$error_level_class">$message</span></dt>
                                                                <p>$info</p>
@@ -12582,7 +12584,7 @@ sub highlight_code
 
        $code =~ s/\$\$PGBGY(A|B)\$\$//gs;
 
-       return $code;
+       return encode('UTF-8', $code);
 }
 
 sub compute_arg_list