Subject: Re: [RFC PATCH] gitweb: use CGI with -utf8

From: Michał Kiedrowicz <[email-masked]>
Date: Thu, 2 Feb 2012 21:38:16 +0100

Jakub Narebski <[email-masked]> wrote:

> Michał Kiedrowicz <[email-masked]> writes:
> 
> > I noticed that gitweb tries a lot to properly process UTF-8 data, for
> > example it prints my name correctly in log and commit information, but
> > it echos junk in the search field. It looks like:
> > 
> > 	MichaÅ Kiedrowicz
> > 
> > I don't know CGI well and I never touched gitewb code, but I found this
> > on http://www.lemoda.net/cgi/perl-unicode/index.html:
> > 
> > 	use CGI '-utf8';
> > 	my $value = params ('input');
> > 
> > I tried it and that fixed my problem. I'm not sure about the
> > consequences, maybe someone more experienced in CGI might help?
> 
> I have reworded this to form a proper commit message (see
> Documentation/SubmittingPatches) and I'll resend this as a reply to
> this email.

Thanks, your message is much better.

> 
> > ---
> >  gitweb/gitweb.perl |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> > index abb5a79..74d45b1 100755
> > --- a/gitweb/gitweb.perl
> > +++ b/gitweb/gitweb.perl
> > @@ -10,7 +10,7 @@
> >  use 5.008;
> >  use strict;
> >  use warnings;
> > -use CGI qw(:standard :escapeHTML -nosticky);
> > +use CGI qw(:standard :escapeHTML -nosticky -utf8);
> >  use CGI::Util qw(unescape);
> >  use CGI::Carp qw(fatalsToBrowser set_message);
> >  use Encode;
> > -- 
> 
> Does this actually work for you? 

Yes. It correctly displays "ł" in the search form.

>  Because it doesn't work for me
> (perhaps I have too old CGI module: what CGI.pm and what Perl version
> do you use?).
> 

$ perl --version

This is perl 5, version 12, subversion 4 (v5.12.4) built for x86_64-linux
(with 12 registered patches, see perl -V for more detail)

$ eix -e CGI -c
[I] perl-core/CGI ([email-masked]): Simple Common Gateway Interface Class

> See other solution to this in other reply to this email.
>