git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH/RFC] gitweb: parse_commit_text encoding fix

From
ZFZoltán Füzesi <zfuzesi@eaglet.hu>
Date
Aug 1, 2009, 08:28 UTC
Message-ID
<1249115323-17974-1-git-send-email-zfuzesi@eaglet.hu>

Call to_utf8 when parsing author and committer names, otherwise they will appear with bad encoding if they written by using chop_and_escape_str.

Signed-off-by: Zoltán Füzesi <zfuzesi@eaglet.hu>
---
 gitweb/gitweb.perl |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 7fbd5ff..06bbf60 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2570,22 +2570,21 @@ sub parse_commit_text {
 		} elsif ((!defined $withparents) && ($line =~ m/^parent ([0-9a-fA-F]{40})$/)) {
 			push @parents, $1;
 		} elsif ($line =~ m/^author (.*) ([0-9]+) (.*)$/) {
-			$co{'author'} = $1;
+			$co{'author'} = to_utf8($1);
 			$co{'author_epoch'} = $2;
 			$co{'author_tz'} = $3;
 			if ($co{'author'} =~ m/^([^<]+) <([^>]*)>/) {
-				$co{'author_name'}  = $1;
+				$co{'author_name'}  = to_utf8($1);
 				$co{'author_email'} = $2;
 			} else {
 				$co{'author_name'} = $co{'author'};
 			}
 		} elsif ($line =~ m/^committer (.*) ([0-9]+) (.*)$/) {
-			$co{'committer'} = $1;
+			$co{'committer'} = to_utf8($1);
 			$co{'committer_epoch'} = $2;
 			$co{'committer_tz'} = $3;
-			$co{'committer_name'} = $co{'committer'};
 			if ($co{'committer'} =~ m/^([^<]+) <([^>]*)>/) {
-				$co{'committer_name'}  = $1;
+				$co{'committer_name'}  = to_utf8($1);
 				$co{'committer_email'} = $2;
 			} else {
 				$co{'committer_name'} = $co{'committer'};
-- 
1.6.4.13.ge6580
Next: Jakub Narebski
Message 1 of 8 in “gitweb: parse_commit_text encoding fix”
  1. gitweb: parse_commit_text encoding fixZoltán Füzesi, Aug 1, 2009
  2. Jakub NarebskiAug 1, 2009
  3. Füzesi ZoltánAug 1, 2009
  4. gitweb: parse_commit_text encoding fixZoltán Füzesi, Aug 2, 2009
  5. Junio C HamanoAug 4, 2009
  6. Zoltán FüzesiAug 6, 2009
  7. Jakub NarebskiAug 7, 2009
  8. Jakub NarebskiAug 7, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.