Subject: | Unicode trouble with FCGI-0.69 and higher using Mason with CGI::Fast |
Date: | Fri, 9 Apr 2010 11:38:16 -0700 (PDT) |
To: | mason-users [...] lists.sourceforge.net, bug-FCGI [...] rt.cpan.org, bug-CGI [...] rt.cpan.org |
From: | Eric Benson <eric_a_benson [...] yahoo.com> |
I'm sending this bug report to the mason-users list as well as the bug reporting mail addresses for the CGI and FCGI Perl modules.
A change in Unicode string handling in the FCGI module between version 0.68 and 0.69 is causing problems for Mason applications deployed with FastCGI, using the CGI::Fast module. I observed this problem in my own application and discovered by searching the Internet that it had been reported previously.
The ChangeLog for FCGI shows this entry for version 0.68_01:
o Fix UTF-8 double encoding when FCGI is passed octets by downgrading
them into bytes correctly. Fixes RT#52400 <chansen@cpan.org>
This appears to be the source of the trouble. A problem report was sent to the mason-users list on March 10 as well as the Request Tracker Users list on March 15 by Vitaly Tskhovrebov:
----------------------------------------------------------------------------------------------
Hello.
I'm trying to use mason with RT 3.8.7 and when I starting it with
FCGI_SOCKET_PATH=/opt/rt3/var/nginx/rt3.fcgi.socket perl /opt/rt3/bin/mason_handler.fcgi &
and trying to browse to, it may return this error:
Wide character in FCGI::Stream::PRINT at /usr/lib64/perl5/site_perl/5.8.8/HTML/Mason/CGIHandler.pm line 106, line 323.
I believe that's related to utf-8 handling, but I Can't understand how to turn on utf-8 by default at whole mason's engine.
-----------------------------------------------------------------------------------------------
He received this response on the Request Tracker Users list from Ruslan Zakirov:
-----------------------------------------------------------------------------------------------
Hello Vitaly.
Downgrade FCGI module to version 0.68.
-----------------------------------------------------------------------------------------------
Vitaly reported that this solved his problem and I also observed that it solved the problem in my application. However, obviously we cannot rely on an obsolete version of a Perl module forever, especially since subsequent versions of FCGI have fixes needed for upcoming Perl version 5.12. Clearly the change described in version 0.68_01 was desired to fix some application, but it seems to have broken other applications. It seems that either that change to FCGI should be modified so that Mason applications with UTF-8 work, or Mason itself should be modified, or the CGI::Fast module should be modified. Perhaps a new parameter is required to be supplied to CGI::Fast or HTML::Mason::CGIHandler to make it UTF-8 aware.