From patchwork Wed Sep 15 19:26:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan-Benedict Glaw X-Patchwork-Id: 12497285 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56880C433EF for ; Wed, 15 Sep 2021 19:32:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 33E0D61178 for ; Wed, 15 Sep 2021 19:32:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231439AbhIOTdr (ORCPT ); Wed, 15 Sep 2021 15:33:47 -0400 Received: from lug-owl.de ([188.68.32.151]:33794 "EHLO lug-owl.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230230AbhIOTdr (ORCPT ); Wed, 15 Sep 2021 15:33:47 -0400 X-Greylist: delayed 339 seconds by postgrey-1.27 at vger.kernel.org; Wed, 15 Sep 2021 15:33:46 EDT Received: by lug-owl.de (Postfix, from userid 1001) id 71B1641F01; Wed, 15 Sep 2021 21:26:47 +0200 (CEST) Date: Wed, 15 Sep 2021 21:26:47 +0200 From: Jan-Benedict Glaw To: git@vger.kernel.org Subject: [PATCH RFC] gitweb: Handle non-ASCII email addresses Message-ID: <20210915192647.6fnk7ktwldz7uubf@lug-owl.de> MIME-Version: 1.0 Content-Disposition: inline X-Operating-System: Linux chamaeleon 5.8.0-0.bpo.2-amd64 X-gpg-fingerprint: 250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB X-gpg-key: wwwkeys.de.pgp.net X-Echelon-Enable: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-TKUeV: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-message-flag: Please send plain text messages only. Do not send HTML emails. Thank you. User-Agent: NeoMutt/20170113 (1.7.2) Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 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: Comments? Thanks, Jan-Benedict --- 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; }