git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Kyle J. McKayNext: Ævar Arnfjörð Bjarmason
Message 10 of 11 in “The gitweb author initials feature from a36817b doesn't work with i18n names”
  1. Ævar Arnfjörð BjarmasonAug 29, 2013
  2. Jakub NarębskiAug 29, 2013
  3. Simon RuderichAug 29, 2013
  4. gitweb: Fix the author initials in blame for non-ASCII namesÆvar Arnfjörð Bjarmason, Aug 30, 2013
  5. Junio C HamanoAug 30, 2013
  6. Jakub NarębskiAug 30, 2013
  7. Junio C HamanoAug 30, 2013
  8. Simon RuderichAug 30, 2013
  9. Kyle J. McKayAug 30, 2013
  10. Jakub NarębskiAug 31, 2013
  11. Ævar Arnfjörð BjarmasonAug 31, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.