On Sun, 2016-04-03 at 17:03 +0200, Vincent Veyron wrote:
> On Sun, 03 Apr 2016 14:11:23 +0100
> Alex Masidlover <alex.masidlo...@zednax.com> wrote:
> 
> > 
> > 
> > This has all worked perfectly up until I upgraded to Apache 2.4 /
> > mod_perl 2.0.10 - 
> After upgrading to Apache 2.4 and mod_perl 2.0.9, I had to make those
> two changes to my application :
> 
> In a PerlOutputFilterHandler, change '$content .= $buffer' to
> '$content .= decode_utf8($buffer)'
> 
> And in response handlers, change '$args{$_} = $req->param($_)' to
> '$args{$_} = decode_utf8($req->param($_))'
> 
> Not sure it applies to your case, but something changed in Apache 2.4
> concerning UTF-8 data.
> 
> If I understood correctly, anything that goes through APR::Table is
> considered UTF-8, however the SvUTF8 flag is not set, so you get
> double encoding when processing your data.
> 

Thanks for the suggestion - its taken a while but I've manage to free
up a machine to roll forwards and test on; unfortunately I've got no
experience with Apache and filters. I've come up with this:

package Zymonic::Decryptor::Filter;
use strict;

use base qw(Apache2::Filter);
use Encode qw(decode);
use constant BUFF_LEN => 1024;
use Apache2::Const -compile => 'OK';

sub utf8_filter : FilterRequestHandler {

my $f = shift;

my $content = '';
while($f->read(my $buffer, BUFF_LEN)) {
$content .= decode_utf8($buffer);
}

$f->print($content);

return Apache2::Const::OK;

}

but when I add it with:

PerlOutputFilterHandler Zymonic::Decryptor::Filter::utf8_filter


I get:

:Apache2 IO flush: (500) Unknown error 500 at -e line 0

in the Apache error log whenever I hit the server with a request.

I'm guessing I've done something very wrong with the filter, but I can
find very few examples of how to use Apache2::Filter.

Thanks,

Alex

-- 
Technical Director - Zednax Limited
W: http://www.zednax.com
T: +44 333 444 0160
F: +44 161 660 8010

Zednax Limited is registered in England and Wales, Company no. 05321754.
Registered address: Meadow House, Meadow Lane, Nottingham, NG2 3HS.
Zednax Limited is VAT registered, VAT registration no. GB 855 4468 92.



Reply via email to