2 # gitweb.cgi wrapper that fixes the UTF-8 problem with fastcgi
4 # Local redefinition of FCGI::Stream::PRINT
8 our $enc = Encode::find_encoding('UTF-8');
9 our $org = \&FCGI::Stream::PRINT;
10 no warnings 'redefine';
12 local *FCGI::Stream::PRINT = sub {
14 for (my $i = 1; $i < @_; $i++) {
15 $OUTPUT[$i] = $enc->encode($_[$i], Encode::FB_CROAK|Encode::LEAVE_SRC);
21 # Execute original script
22 do "/usr/share/gitweb/gitweb.cgi";