]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/highlight.pm
Merge commit 'remotes/github/aggregate' into slop
[git.ikiwiki.info.git] / IkiWiki / Plugin / highlight.pm
index 4c02f6c236e4feca4f6113e73f793bee683fef2c..9bdde85ae3bfd725ee83265b923eb445021a15c4 100644 (file)
@@ -4,6 +4,7 @@ package IkiWiki::Plugin::highlight;
 use warnings;
 use strict;
 use IkiWiki 3.00;
 use warnings;
 use strict;
 use IkiWiki 3.00;
+use Encode;
 
 # locations of highlight's files
 my $filetypes="/etc/highlight/filetypes.conf";
 
 # locations of highlight's files
 my $filetypes="/etc/highlight/filetypes.conf";
@@ -69,7 +70,7 @@ sub htmlizefallback {
                return;
        }
 
                return;
        }
 
-       return highlight($langfile, shift);
+       return Encode::decode_utf8(highlight($langfile, shift));
 }
 
 my %ext2lang;
 }
 
 my %ext2lang;
@@ -128,8 +129,8 @@ sub highlight ($$) {
                $gen = highlightc::CodeGenerator_getInstance($highlightc::XHTML);
                $gen->setFragmentCode(1); # generate html fragment
                $gen->setHTMLEnclosePreTag(1); # include stylish <pre>
                $gen = highlightc::CodeGenerator_getInstance($highlightc::XHTML);
                $gen->setFragmentCode(1); # generate html fragment
                $gen->setHTMLEnclosePreTag(1); # include stylish <pre>
-               $gen->initLanguage($langfile);
                $gen->initTheme("/dev/null"); # theme is not needed because CSS is not emitted
                $gen->initTheme("/dev/null"); # theme is not needed because CSS is not emitted
+               $gen->initLanguage($langfile); # must come after initTheme
                $gen->setEncoding("utf-8");
                $highlighters{$langfile}=$gen;
        }
                $gen->setEncoding("utf-8");
                $highlighters{$langfile}=$gen;
        }