Re: [PATCH 2/4] gitweb: Make feed title valid utf8

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 2/4] gitweb: Make feed title valid utf8

From: Jürgen Kreileder <hidden>
Date: 2016-06-15 22:56:45

Jakub Narębski [off-list ref] writes:
Jürgen Kreileder wrote:
quoted
Properly encode site and project names for RSS and Atom feeds.

Signed-off-by: Jürgen Kreileder <redacted>
---
 gitweb/gitweb.perl |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 9cfe5b5..09294eb 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -8056,7 +8056,7 @@ sub git_feed {
 	return if ($cgi->request_method() eq 'HEAD');
 
 	# header variables
-	my $title = "$site_name - $project/$action";
+	my $title = to_utf8($site_name) . " - " . to_utf8($project) . "/$action";
 	my $feed_type = 'log';
 	if (defined $hash) {
 		$title .= " - '$hash'";
Was this patch triggered by some bug?
Yes, I actually see broken encoding with the old code, e.g on 
https://git.blackdown.de/old.cgi?p=contactalbum.git;a=rss
my first name is messed up in the title tag.

New version: https://git.blackdown.de/?p=contactalbum.git;a=rss
Because the above is not necessary, as git_feed() has

	$title = esc_html($title);

a bit later, which does to_utf8() internally.
Good point.  But it doesn't fix the string in question:
It looks like to_utf8("$a $b") != (to_utf8($a) . " " . to_utf($b)).


Juergen

Re: [PATCH 2/4] gitweb: Make feed title valid utf8

From: Jakub Narębski <hidden>
Date: 2016-06-15 22:56:45

W dniu 09.04.2013 19:40, Jürgen Kreileder napisał:
Jakub Narębski [off-list ref] writes:
quoted
Jürgen Kreileder wrote:
quoted
Properly encode site and project names for RSS and Atom feeds.
quoted
quoted
-	my $title = "$site_name - $project/$action";
+	my $title = to_utf8($site_name) . " - " . to_utf8($project) . "/$action";
quoted
Was this patch triggered by some bug?
Yes, I actually see broken encoding with the old code, e.g on 
https://git.blackdown.de/old.cgi?p=contactalbum.git;a=rss
my first name is messed up in the title tag.

New version: https://git.blackdown.de/?p=contactalbum.git;a=rss
quoted
Because the above is not necessary, as git_feed() has

	$title = esc_html($title);

a bit later, which does to_utf8() internally.
Good point.  But it doesn't fix the string in question:
It looks like to_utf8("$a $b") != (to_utf8($a) . " " . to_utf8($b)).
Strange.  I wonder if the bug is in our to_utf8() implementation,
or in Encode, or in Perl... and whether this bug can be triggered
anywhere else in gitweb.

What Perl version and Encode module version do you use?
-- 
Jakub Narębski
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help