Re: The gitweb author initials feature from a36817b doesn't work with i18n names
On Thu, Aug 29, 2013 at 04:26:29PM +0200, Ævar Arnfjörð Bjarmason wrote: > I haven't gotten an env where I can test gitweb running, but that > looks like it should work to me. I've tested the patch and it works fine. Tested-by: Simon Ruderich Regards Simon -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: The gitweb author initials feature from a36817b doesn't work with i18n names
[Ævar, sorry for duplication but I accidentally send HTML email; stupid Gmail] On Thu, Aug 29, 2013 at 4:26 PM, Ævar Arnfjörð Bjarmason wrote: > The @author_initials feature Jakub added in a36817b claims to use a > i18n regexp (/\b([[:upper:]])\B/g), but in Perl this doesn't actually > do anything unless the string being matched against has the UTF8 flag. > > So as a result it abbreviates me to "AB" not "ÆAB". [...] Thanks for catching this, and for an analysis. > Jakub, do you see a reason not to just apply this: > > diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl > index f429f75..29b3fb5 100755 > --- a/gitweb/gitweb.perl > +++ b/gitweb/gitweb.perl > @@ -6631,6 +6631,7 @@ sub git_blame_common { > $hash_base, '--', $file_name > or die_error(500, "Open git-blame --porcelain > failed"); > } > + binmode $fd, ":utf8"; > > # incremental blame data returns early > if ($format eq 'data') { > > I haven't gotten an env where I can test gitweb running, but that > looks like it should work to me. Unfortunetly I cannot check this either, but it looks obviously correct. ACK. -- Jakub Narebski -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
The gitweb author initials feature from a36817b doesn't work with i18n names
The @author_initials feature Jakub added in a36817b claims to use a i18n regexp (/\b([[:upper:]])\B/g), but in Perl this doesn't actually do anything unless the string being matched against has the UTF8 flag. So as a result it abbreviates me to "AB" not "ÆAB". Here's something that demonstrates the issue: $ cat author-initials.pl #!/usr/bin/env perl use strict; use warnings; #binmode STDOUT, ':utf8'; open my $fd, "-|", "git", "blame", "--incremental", "--", "Makefile" or die "Can't open: $!"; #binmode $fd, ":utf8"; while (my $line = <$fd>) { next unless my ($author) = $line =~ /^author (.*)/; my @author_initials = ($author =~ /\b([[:upper:]])\B/g); printf "%s (%s)\n", join("", @author_initials), $author; } With those two binmode commands commented out: $ perl author-initials.pl |sort|uniq -c|sort -nr|head -n 5 99 JH (Junio C Hamano) 35 JN (Jonathan Nieder) 35 JK (Jeff King) 20 JS (Johannes Schindelin) 16 AB (Ævar Arnfjörð Bjarmason) And uncommented: $ perl author-initials.pl |sort|uniq -c|sort -nr|head -n 5 99 JH (Junio C Hamano) 35 JN (Jonathan Nieder) 35 JK (Jeff King) 20 JS (Johannes Schindelin) 16 ÆAB (Ævar Arnfjörð Bjarmason) Jakub, do you see a reason not to just apply this: diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index f429f75..29b3fb5 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -6631,6 +6631,7 @@ sub git_blame_common { $hash_base, '--', $file_name or die_error(500, "Open git-blame --porcelain failed"); } + binmode $fd, ":utf8"; # incremental blame data returns early if ($format eq 'data') { I haven't gotten an env where I can test gitweb running, but that looks like it should work to me. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html