]> git.ipfire.org Git - thirdparty/git.git/commit
gitweb: fix UTF-8 encoding when using CGI::Fast
authorJulien Moutinho <julm+git@sourcephile.fr>
Sun, 29 Mar 2020 00:20:28 +0000 (01:20 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 29 Mar 2020 16:06:51 +0000 (09:06 -0700)
commit2ecfcdecc612505291cfdffb886b5d7615c3e581
tree4800401b4c26b8bbce992bf1bb8eadfade1d62d3
parent0822e66b5d49d0de1aa767b38785e42de05eaf40
gitweb: fix UTF-8 encoding when using CGI::Fast

FCGI streams are implemented using the older stream API: TIEHANDLE,
therefore applying PerlIO layers using binmode() has no effect to them.
The solution in this patch is to redefine the FCGI::Stream::PRINT function
to use UTF-8 as output encoding, except within git_blob_plain() and git_snapshot()
which must still output in raw binary mode.

This problem and solution were previously reported back in 2012:
- http://git.661346.n2.nabble.com/Gitweb-running-as-FCGI-does-not-print-its-output-in-UTF-8-td7573415.html
- http://stackoverflow.com/questions/5005104

Signed-off-by: Julien Moutinho <julm+git@sourcephile.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl