Re: Output filters, data encoding

Vincent Veyron <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On Wed, 13 Nov 2019 19:12:10 +0100
André Warnier (tomcat/perl) <[email protected]> wrote:
> 

I also found that calls to binmode in output filters generate a double encoding.

Here is a paste of the code of an output filter that adds a menu, some headers and closing tags to the html pages generated by previous modules; it reads from STDOUT, not from a file:

https://pastebin.com/trhjfDxX

It uses this :

>   #on arrive à la fin du contenu
>    if ($f->seen_eos) {
>       
>        $content = Encode::decode_utf8( $content ) . '</div>' ;
        

Never had a problem with it.

I have handlers, not output filters, that read from files and use this :

    open DOCUMENT_CONTENT, "<:encoding(UTF-8)", "$document_content" or die "can't open $document_content : $!\n" ;


-- 

					Bien à vous, Vincent Veyron 

https://compta.libremen.com
Logiciel libre de comptabilité générale en partie double
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.