]> Pileus Git - ~andy/git/commitdiff
gitweb: pass string after encoding in utf-8 to syntax highlighter
author张忠山 <zzs213@126.com>
Thu, 4 Aug 2011 15:52:55 +0000 (23:52 +0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 4 Aug 2011 19:13:38 +0000 (12:13 -0700)
Otherwise the highlight filter would work on a corrupt byte sequence.

Signed-off-by: 张忠山 <zzs213@126.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl

index dab89f2eb013c78fa7c3b4fadba3061ef6d7f1ed..48def3841f13264134e1ab27673b8785d8b31f5b 100755 (executable)
@@ -6465,7 +6465,7 @@ sub git_blob {
                        $nr++;
                        $line = untabify($line);
                        printf qq!<div class="pre"><a id="l%i" href="%s#l%i" class="linenr">%4i</a> %s</div>\n!,
-                              $nr, esc_attr(href(-replay => 1)), $nr, $nr, $syntax ? $line : esc_html($line, -nbsp=>1);
+                              $nr, esc_attr(href(-replay => 1)), $nr, $nr, $syntax ? to_utf8($line) : esc_html($line, -nbsp=>1);
                }
        }
        close $fd