# [PATCH RFC] gitweb: Handle non-ASCII email addresses

2 messages from 2021-09-15 to 2021-09-22. Participants: Jan-Benedict Glaw.
Thread: https://gitlist.dev/t/56507

## Jan-Benedict Glaw, 2021-09-15 19:26

Subject: [PATCH RFC] gitweb: Handle non-ASCII email addresses
Message-ID: <20210915192647.6fnk7ktwldz7uubf@lug-owl.de>
URL: https://gitlist.dev/e/20210915192647.6fnk7ktwldz7uubf%40lug-owl.de

```
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

-- 

```

## Jan-Benedict Glaw, 2021-09-22 17:42

Subject: *ping* [PATCH RFC] gitweb: Handle non-ASCII email addresses
Message-ID: <20210922174228.2i2bz2fx3ap45s75@lug-owl.de>
URL: https://gitlist.dev/e/20210922174228.2i2bz2fx3ap45s75%40lug-owl.de
In-Reply-To: <20210915192647.6fnk7ktwldz7uubf@lug-owl.de>

```
Hi!

On Wed, 2021-09-15 21:26:47 +0200, Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:
> 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?

I'd like to get some comment on this, maybe for anybody to merge it?

Thanks,
  Jan-Benedict

-- 

```
