diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2015-06-01 00:37:30 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2015-06-07 02:54:06 +0200 |
commit | f1d44763617f2d3e8c60e6314831da886c97139d (patch) | |
tree | 8f0b02c2b638063a99b0880065e4dabca8ef337b /roles/git/files/usr/lib/cgi-bin | |
parent | 6be6477f82cd469b688270e3e6ceff0bf347060c (diff) |
gitweb workaround encoding issues in FCGI mode.
Diffstat (limited to 'roles/git/files/usr/lib/cgi-bin')
-rwxr-xr-x | roles/git/files/usr/lib/cgi-bin/gitweb-wrapper.fcgi | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/roles/git/files/usr/lib/cgi-bin/gitweb-wrapper.fcgi b/roles/git/files/usr/lib/cgi-bin/gitweb-wrapper.fcgi new file mode 100755 index 0000000..a7eea8c --- /dev/null +++ b/roles/git/files/usr/lib/cgi-bin/gitweb-wrapper.fcgi @@ -0,0 +1,22 @@ +#!/usr/bin/perl +# gitweb.cgi wrapper that fixes the UTF-8 problem with fastcgi + +# Local redefinition of FCGI::Stream::PRINT +use Encode; +use FCGI; + +our $enc = Encode::find_encoding('UTF-8'); +our $org = \&FCGI::Stream::PRINT; +no warnings 'redefine'; + +local *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; +}; + +# Execute original script +do "/usr/lib/cgi-bin/gitweb.cgi"; |