From: zzs <zzs213@126.com>
To: git@vger.kernel.org
Subject: gitweb highligh generate illegal char when the content had utf-8 chars
Date: Thu, 4 Aug 2011 13:31:23 +0800 [thread overview]
Message-ID: <20110804053123.GA13198@greatfirst.com> (raw)
When my C file had some utf-8 comments, gitweb highlight generate
illegal chars.
So I hacked gitweb.cgi, like this:
---------------------------
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
---------------------------
And it works.
But I wonder is this the rigtht solution.
Anybody help me?
--
Best Regards
zzs
next reply other threads:[~2011-08-04 6:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-04 5:31 zzs [this message]
2011-08-04 9:11 ` gitweb highligh generate illegal char when the content had utf-8 chars Ramkumar Ramachandra
2011-08-04 9:39 ` Jakub Narębski
2011-08-04 10:05 ` Ramkumar Ramachandra
2011-08-04 15:52 ` [PATCH] fix gitweb syntax highlight utf-8 encode bug zzs
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110804053123.GA13198@greatfirst.com \
--to=zzs213@126.com \
--cc=git@vger.kernel.org \
/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.
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 NNTP newsgroup(s).