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

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

From
Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Date
Feb 2, 2012, 20:38 UTC
Message-ID
<20120202213816.1eabe031@gmail.com>
In-Reply-To
<m37h05c8c1.fsf@localhost.localdomain>
Jakub Narebski <jnareb@gmail.com> wrote:
Show 20 quoted lines
> Michał Kiedrowicz <michal.kiedrowicz@gmail.com> 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.
Show 21 quoted lines
> 
> > ---
> >  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 (3.510@01.02.2012): Simple Common Gateway Interface Class

> See other solution to this in other reply to this email.
> 
Previous: Junio C Hamano
Message 14 of 14 in “gitweb: use CGI with -utf8”
  1. gitweb: use CGI with -utf8Michał Kiedrowicz, Feb 1, 2012
  2. Jakub NarebskiFeb 2, 2012
  3. gitweb: use CGI with -utf8 to process Unicode query parameters correctlyJakub Narebski, Feb 2, 2012
  4. Jakub NarebskiFeb 2, 2012
  5. Michał KiedrowiczFeb 2, 2012
  6. gitweb: Allow UTF-8 encoded CGI query parameters and path_infoJakub Narebski, Feb 2, 2012
  7. Michał KiedrowiczFeb 2, 2012
  8. Jakub NarebskiFeb 2, 2012
  9. Jakub NarebskiFeb 2, 2012
  10. Michal KiedrowiczFeb 3, 2012
  11. gitweb: Allow UTF-8 encoded CGI query parameters and path_infoJakub Narebski, Feb 3, 2012
  12. Michał KiedrowiczFeb 3, 2012
  13. Junio C HamanoFeb 3, 2012
  14. Michał KiedrowiczFeb 2, 2012

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.