From: Julien Moutinho <julm+git@sourcephile.fr>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] gitweb: fix UTF-8 encoding when using CGI::Fast
Date: Sun, 29 Mar 2020 21:14:00 +0200 [thread overview]
Message-ID: <20200329191400.eh377knm4fxm66pd@sourcephile.fr> (raw)
In-Reply-To: <xmqqr1xbb0xr.fsf@gitster.c.googlers.com>
Le dim. 29 mars 2020 09h06 -0700, Junio C Hamano a écrit :
> Julien Moutinho <julm+git@sourcephile.fr> writes:
> > require CGI::Fast;
> > our $CGI = 'CGI::Fast';
> > + # FCGI is not Unicode aware hence the UTF-8 encoding must be done manually.
> > + # However no encoding must be done within git_blob_plain() and git_snapshot()
> > + # which must still output in raw binary mode.
>
> I guess this comment would be sufficient to help future developers
> when they find that newer version of CGI::Fast has become Unicode
> aware later can make this part conditional to the version of the
> module, perhaps?
Sure, though as long as CGI::Fast will be relying on FCGI,
I would not bet on any improvement on this bug
which has been waiting to be fixed on FCGI's bugtracker since 2013:
https://rt.cpan.org/Public/Bug/Display.html?id=89383
> Would "use CGI::Fast (-utf8)" instead of the whole thing help, by
> the way?
Unfortunately not, the -utf8 option (aka. $CGI::$PARAM_UTF8)
controls the decoding of the input parameters,
not the encoding of the output.
- https://metacpan.org/pod/CGI#-utf8
- https://stackoverflow.com/questions/5005104/how-to-force-fastcgi-to-encode-form-data-as-utf-8-as-cgi-pm-has-option/7097698#7097698
> > our $FCGI_Stream_PRINT_raw = \&FCGI::Stream::PRINT;
> [...]
> > + local *FCGI::Stream::PRINT = $FCGI_Stream_PRINT_raw;
I had forgotten to test the patch without FastCGI,
but AFAICS it is innocuous in non-FastCGI mode:
Perl does not chokes on \&FCGI::Stream::PRINT despite it being not reachable,
and the local binding emits no redefine warning since it's not a redefine
in this case, but a define.
Regards,
prev parent reply other threads:[~2020-03-29 19:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-29 0:20 [PATCH] gitweb: fix UTF-8 encoding when using CGI::Fast Julien Moutinho
2020-03-29 16:06 ` Junio C Hamano
2020-03-29 19:14 ` Julien Moutinho [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200329191400.eh377knm4fxm66pd@sourcephile.fr \
--to=julm+git@sourcephile.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).