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

Re: gitweb: HTML output is not always encoded in UTF-8 when using --fastcgi.

From
JMJulien Moutinho <julm+git@autogeree.net>
Date
Sep 8, 2018, 18:14 UTC
Message-ID
<20180908181439.jdbvdrzndvdy7gkc@localhost>
In-Reply-To
<20180908171532.uyz7i5oy6w6otp2r@localhost>
Le sam. 08 sept. 2018 à 19:15:32 +0200, Julien Moutinho a écrit :
> As a quick workaround this hotpatch can even be put in $GITWEB_CONFIG
> by removing the `local` before `*FCGI::Stream::PRINT`.
Turns out to require more care than that,
due to $per_request_config reloading $GITWEB_CONFIG at each request,
overwriting FCGI::Stream::PRINT multiple times, messing the encoding.
This seems to work(around):
| if ($first_request) {
|         my $enc = Encode::find_encoding('UTF-8');
|         my $org = \&FCGI::Stream::PRINT;
|         no warnings 'redefine';
|         *FCGI::Stream::PRINT = sub {
|             my @OUTPUT = @_;
|             for (my $i = 1; $i < @_; $i++) {
|                 $OUTPUT[$i] = $enc->encode($_[$i], Encode::FB_CROAK|Encode::LEAVE_SRC);
|             }
|             @_ = @OUTPUT;
|             goto $org;
|         };
| }
Previous: Julien Moutinho
Message 2 of 2 in “gitweb: HTML output is not always encoded in UTF-8 when using --fastcgi.”
  1. Julien MoutinhoSep 8, 2018
  2. Julien MoutinhoSep 8, 2018

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.