From: Shin Kojima Date: Tue, 01 May 2018 06:40:15 GMT Subject: [PATCH] gitweb: Measure offsets against UTF-8 flagged string Message-ID: <20180501064015.59977-1-shin@kojima.org> Offset positions should not be counted by byte length, but by actual character length. > 5183 # We need to untabify lines before split()'ing them; > 5184 # otherwise offsets would be invalid. Horizontal tab is not the only case we need to consider. Please excuse me for using your name here, but the following URL can not find "match" occurances while using `git-instaweb` on the git repository. http://127.0.0.1:1234/?p=.git&a=search&h=HEAD&st=grep&s=Nar%C4%99bski Signed-off-by: Shin Kojima --- gitweb/gitweb.perl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 2594a4bad..a5a9093a1 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -1697,7 +1697,7 @@ sub unquote { # escape tabs (convert tabs to spaces) sub untabify { - my $line = shift; + my $line = to_utf8(shift); while ((my $pos = index($line, "\t")) != -1) { if (my $count = (8 - ($pos % 8))) { -- 2.17.0