From: Mischa POSLAWSKY Date: Sat, 31 Jan 2015 21:39:41 +0000 (+0100) Subject: source: upgrade vim output to unicode X-Git-Tag: v1.6~39 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/909a8fb315ca7feceeb811d56e0b06934b3de6da source: upgrade vim output to unicode Prevents utf8 output from being parsed as latin1 if open modes aren't set (apparently with mod_perl execution at least). --- diff --git a/source.plp b/source.plp index f476ee8..7b0ebec 100644 --- a/source.plp +++ b/source.plp @@ -68,6 +68,7 @@ else { } -r $source or die "Requested file not found\n"; + require Encode; if (eval { require Text::VimColor and Text::VimColor->VERSION(0.12) }) { delete $Text::VimColor::SYNTAX_TYPE{Underlined}; my %TYPETAG = ( @@ -93,13 +94,12 @@ else { if (!$_->[0] and $_->[1] =~ s/^(\s*)([A-Z]\w+(?:::\w+)+)(?![^;\s])//) { printf '%s%s', $1, "/source/$2", $2; } - print Text::VimColor::_xml_escape($_->[1]); + print Text::VimColor::_xml_escape(Encode::decode_utf8($_->[1])); print "" if $tag; } print "\n"; } else { - require Encode; print "
\n";
 		print EscapeHTML(Encode::decode_utf8(ReadFile($source)));
 		print "
\n";