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

[PATCH] fix gitweb syntax highlight utf-8 encode bug

From
Zzzs <zzs213@126.com>
Date
Aug 4, 2011, 15:52 UTC
Message-ID
<1312473175-28195-1-git-send-email-zzs213@126.com>
In-Reply-To
<CALkWK0kOTXyevPy0Ys+pWwGjr2NSo3+ifhWuPVU+=FL=LC=J7A@mail.gmail.com>
From: 张忠山 <zzs213@126.com>
Signed-off-by: 张忠山 <zzs213@126.com>
---
 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index dab89f2..48def38 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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
-- 
1.7.4.4
Previous: Ramkumar Ramachandra
Message 5 of 5 in “gitweb highligh generate illegal char when the content had utf-8 chars”
  1. zzsAug 4, 2011
  2. Ramkumar RamachandraAug 4, 2011
  3. Jakub NarębskiAug 4, 2011
  4. Ramkumar RamachandraAug 4, 2011
  5. fix gitweb syntax highlight utf-8 encode bugzzs, Aug 4, 2011

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.