git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Shin Kojima <shin@kojima.org>
To: git@vger.kernel.org
Cc: jnareb@gmail.com, Shin Kojima <shin@kojima.org>
Subject: [PATCH] gitweb: Measure offsets against UTF-8 flagged string
Date: Tue,  1 May 2018 15:40:15 +0900	[thread overview]
Message-ID: <20180501064015.59977-1-shin@kojima.org> (raw)

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


             reply	other threads:[~2018-05-01  6:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-01  6:40 Shin Kojima [this message]
2018-05-02  8:01 ` [PATCH] gitweb: Measure offsets against UTF-8 flagged string 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180501064015.59977-1-shin@kojima.org \
    --to=shin@kojima.org \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).