git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] gitweb: Measure offsets against UTF-8 flagged string
@ 2018-05-01  6:40 Shin Kojima
  2018-05-02  8:01 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Shin Kojima @ 2018-05-01  6:40 UTC (permalink / raw)
  To: git; +Cc: jnareb, Shin Kojima

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 <shin@kojima.org>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-05-04  2:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-01  6:40 [PATCH] gitweb: Measure offsets against UTF-8 flagged string Shin Kojima
2018-05-02  8:01 ` Junio C Hamano
2018-05-02 11:47   ` Shin Kojima
2018-05-03 12:40   ` Jakub Narebski
2018-05-03 15:16     ` Shin Kojima
2018-05-04  2:38     ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).