Re: [PATCH] gitweb: Fix the author initials in blame for non-ASCII names
- From
Jakub Narębski <jnareb@gmail.com>
- Date
- Aug 31, 2013, 16:42 UTC
- Message-ID
- <CANQwDwdrmyMLZ299t4T-o6uGmfbHL_A83R37_zy0-jyFXEq1+A@mail.gmail.com>
- In-Reply-To
- <74435A51-B404-4EC8-8CF8-6289F49E6DBD@gmail.com>
On Fri, Aug 30, 2013 at 11:39 PM, Kyle J. McKay <mackyle@gmail.com> wrote:
> On Aug 30, 2013, at 11:13, Junio C Hamano wrote: >> Junio C Hamano <gitster@pobox.com> writes: >>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>>>> + binmode $fh, ':utf8';
Show 8 quoted lines
> What happens if the author name is written in ISO-8859-1 instead of UTF-8 in > the actual commit object itself? > > I'm pretty sure I've seen this where older commits have a ISO-8859-1 author > name and then newer commits have a UTF-8 version of the same author's name. > > In fact, in the git repository itself, look at commit 0cb3f80d (UTF-8) and > commit 7eb93c89 (ISO-8859-1) to see this in action.
Well, then you have a problem, though it is only with old history (before introduction of "encoding" header in commit object).
Better and more complete solution would be to use to_utf8() function instead of 'utf8' layer, which when finding invalid UTF-8 sequence uses $fallback_encoding (by default "latin1", i.e. ISO-8859-1) instead.
In my TODO list is creating PerlIO layer ':utf8-with-fallback' which would replace all those to_utf8() calls...
-- Jakub Narebski