Subject: | Problem with using Catalyst::Plugin::Unicode::Encoding and Catalyst::Plugin::Compress together |
Date: | Thu, 23 Feb 2012 11:01:49 +0100 |
To: | bug-Catalyst-Plugin-Compress [...] rt.cpan.org, bug-Catalyst-Plugin-Unicode-Encoding [...] rt.cpan.org |
From: | Thijs Oppermann <thijs.oppermann [...] tty.nl> |
First of all, Catalyst::Plugin::Compress tells me how I should use it
with Catalyst::Plugin::Unicode, but Catalyst::Plugin::Unicode tells me
it's deprecated in favor of Catalyst::Plugin::Unicode::Encoding.
So maybe this link in the POD can be corrected to point to
Catalyst::Plugin::Unicode::Encoding.
However, using these two together (Catalyst::Plugin::Unicode::Encoding
and Catalyst::Plugin::Compress) doesn't work. I get a 'Content Encoding
Error' in my browser and a 'Wide character in memGzip' exception in my
apache log.
Changing the order in with I 'use' them doesn't help.
I think the problem is that Catalyst::Plugin::Compress hooks into
'finalize', while Catalyst::Plugin::Unicode::Encoding hooks into
'finalize_headers'. This means that Catalyst::Plugin::Unicode::Encoding
will always run *after* Catalyst::Plugin::Compress (I think?), which is
of course exactly what you *don't* want.
I've written my own Compress plugin that hooks into 'finalize_headers'
and that does work. I'm not sure that that's the correct place, though,
so maybe the solution should be to hook
Catalyst::Plugin::Unicode::Encoding into 'finalize' instead.
Thijs