perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Christophe Boggio <>
Subject Re: Strange problem with input charset ?
Date Mon, 20 Dec 2010 23:02:57 GMT
Well, maybe I should reword my question.

I want to place links to PDF files on my site like :

<a href="/pdf/v01.pdf">Click here to download</a>

And I want to log the fact that someone downloaded the file.

So I set Apache up so that all PDF files are handled by Embperl :

<FilesMatch "\.(pdf|html)$">
   SetHandler perl-script
   PerlHandler Embperl::Object
   Options ExecCGI

Inside my "base.epl", I distinguish .pdf from .html and proceed
accordingly :

[$ if ($ENV{SCRIPT_NAME} =~ /\.pdf$/) $]
     $ENV{SCRIPT_NAME} =~ /.*\/(.*\.pdf)$/;
     my $filename = $1;
     Execute('auth.epl'); # This is where the logging takes place
       $http_headers_out{'Content-Disposition'}="attachment; filename=$filename";
       local ($/);
       local ($escmode);
       my $pdf=<PDF>;
       print OUT $pdf;
     exit 1;
[$ endif $]

This worked very well until I switched to UTF8 and discovered that Embperl
was actually loading in the PDF file (like an Execute() ). I thought it would
only do it when it would encounter :


(which I wouldn't have done for PDF of course) but for some reason, it does read
it. And some PDF files contain some characters, invalid in the UTF8 sense, that
prevent the script to work.

So, is there a way to do what I'm trying to do ?

Thanks a lot for reading this far and for your precious help/hint/guidline...


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message