]> Lady’s Gitweb - Gitweb/commit
gitweb: fix UTF-8 encoding when using CGI::Fast
authorJulien Moutinho <redacted>
Sun, 29 Mar 2020 00:20:28 +0000 (01:20 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:33 +0000 (00:51 -0400)
commit2e9eb54733874ccbae8627f957ea496ec79b09e4953c0f54476897e7f4350ed9
treec31b4b91ea94c7e4a7150fb546ff1a067dde5cd86bf89ca386e223b4d2f51fec
parentcc8201643cab52770ddf95c5e381b79477f1e3bbf8d310e47705a6c6dff28ae3
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl
This page took 0.119163 seconds and 4 git commands to generate.