source: encode vim output before link parsing
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 3 Feb 2015 00:22:18 +0000 (01:22 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 5 Feb 2015 21:46:21 +0000 (22:46 +0100)
Do not keep operating on octet strings.

source.plp

index f98c0ec82cd609f419ff7ac95c6174f1815e6ca1..469f49e7250344926b12592ab535e7d154cf1077 100644 (file)
@@ -85,6 +85,7 @@ else {
                print "<pre>\n";
                foreach (@$parsed) {
                        my ($type, $contents) = @{$_};
+                       $contents = Encode::decode_utf8($contents);
                        my $tag = $type && ($TYPETAG{$type} || 'span');
                        my $arg = '';
                        print "<$tag$arg class=\"sy-\l$type\">" if $tag;
@@ -95,7 +96,7 @@ else {
                        if (!$type and $contents =~ s/^(\s*)([A-Z]\w+(?:::\w+)+)(?![^;\s])//) {
                                printf '%s<a href="%s">%s</a>', $1, "/source/$2", $2;
                        }
-                       print Text::VimColor::_xml_escape(Encode::decode_utf8($contents));
+                       print Text::VimColor::_xml_escape($contents);
                        print "</$tag>" if $tag;
                }
                print "</pre>\n";