[Catalyst] Unicode trouble with Catalyst::Engine::FastCGI

Mark Blackman m.blackman at fairfx.com
Tue Jan 5 12:32:16 GMT 2010

On 23 Nov 2009, at 11:57, Bernhard Graf wrote:

> After I recently re-installed my Development-Perl (that one, that I use
> apart from the production Perl installation), all pages that went
> through Catalyst::Engine::FastCGI got double-utf8-encoded.
> When using the standalone HTTP server, everything is fine.
> Both installations used Perl 5.10.1. I did a snapshot of the old modules
> at first and then re-installed everything on the new installation.
> Googling around I found
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg00051.html ,
> but I couldn't verify Jonathan's assumption in my case - even before the
> buffer is written into the FastCGI pipe in
> Catalyst::Engine::FastCGI::write the whole buffer (header and body)
> looked fine right before calling STDOUT->syswrite.
> Is there anyone here, who has experienced similar effects and maybe
> found a solution (besides kicking out the FastCGI engine)?

For us, we think the implicit concatenation in our templates 
of both encoded (utf8 off) and decoded data (utf8 on) led to this 
result with FastCGI and Catalyst::Plugin::Unicode (now discouraged I see).

The "cure" was to use the DBD::Pg specific pg_enable_utf8 attribute
to persuade DBD::Pg to return decoded strings instead of the
default encoded ones. We are also running our Perl binary with
the '-CSD' flags, so that all inputs and outputs are regarded 
as UTF-8 encoded, but I'm not convinced this step is particularly

- Mark

More information about the Catalyst mailing list