source: preserve utf8 of unhighlighted input
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 8 Dec 2010 23:06:55 +0000 (00:06 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 15 Dec 2010 21:40:44 +0000 (22:40 +0100)
PLP::ReadFile() is declared before open mode can be set to :utf8, so may
cause corruption if not converted back to unicode.

source.plp

index 83a583385966b1b4285c0522667959ef294af682..ee129cee23de856af5413c55ca3305284dd17374 100644 (file)
@@ -76,7 +76,10 @@ else {
                print "</pre>\n";
        }
        else {
                print "</pre>\n";
        }
        else {
-               print "<pre>\n", EscapeHTML(ReadFile($source)), "</pre>\n";
+               require Encode;
+               print "<pre>\n";
+               print EscapeHTML(Encode::decode_utf8(ReadFile($source)));
+               print "</pre>\n";
        }
 
        print "\n";
        }
 
        print "\n";