[PATCH RFC] gitweb: Handle non-ASCII email addresses
To
git@vger.kernel.org
From
Jan-Benedict Glaw
Date
2021-09-15 19:26:47 UTC
Hi!

I accidentally had a bad user.email setting ("jbglaw@ług-owl.de"
instead of "jbglaw@lug-owl.de") and this leads to incomplete HTML
being generated by gitweb, along with an error message:

index.cgi: Wide character in subroutine entry at /usr/share/gitweb/index.cgi line 2208.

This patch may fix it, but I'm NOT a Perl guy:

--- a/gitweb/gitweb.perl	2021-09-15 20:23:13.788195846 +0200
+++ b/gitweb/gitweb.perl	2021-09-15 20:24:19.911806868 +0200
@@ -2193,7 +2193,7 @@
 	my $size = shift;
 	$avatar_cache{$email} ||=
 		"//www.gravatar.com/avatar/" .
-			md5_hex($email) . "?s=";
+			md5_hex(utf8::is_utf8($email)? Encode::encode_utf8($email): $email) . "?s=";
 	return $avatar_cache{$email} . $size;
 }


Comments?

Thanks,
  Jan-Benedict

-- 
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQQlDTvPcScNjKREqWEdvV51g5nhuwUCYUJI8wAKCRAdvV51g5nh
u3SOAKCJkb1Nyr6W6o5eI7a+DIbMW/TMLwCfZpNQrwLFAuQ+cI4P+IdgZu+N0TM=
=ZKIg
-----END PGP SIGNATURE-----