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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
|         };
| }



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux