Re: Output filters, data encoding
André Warnier (tomcat/perl) <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
On 13.11.2019 19:53, [email protected] wrote: > On Wednesday 13 November 2019 19:52:25 André Warnier (tomcat/perl) wrote: >> On 13.11.2019 19:17, [email protected] wrote: >>> On Wednesday 13 November 2019 19:12:10 André Warnier (tomcat/perl) wrote: >>>> My question is : can I - and how -, set the filehandle that corresponds to >>>> the $f->read(), to a UTF-8 layer ? >>>> I have tried >>>> >>>> line 155: binmode($f,'encoding:(UTF-8)'); >>> >>> Hi André! When specifying PerlIO layer for file handle, you need to >>> write colon character before layer name. So correct binmode call is: >>> >>> binmode($f, ':encoding(UTF-8)'); >>> >>>> and that triggers an error : >>>> Not a GLOB reference at (my filter) line 155.\n >>>> ) >> >> Thanks. Ooops, that was a typo (also in my filter, not only in the list message). >> But correcting it, does not change the GLOB error message. > > Ok. What is the $f? It is object or what kind of scalar? > It is the Apache2::Filter object. See : http://perl.apache.org/docs/2.0/api/Apache2/Filter.html Configured in httpd as : PerlOutputFilterHandler MyFilter See also : http://perl.apache.org/docs/2.0/user/handlers/filters.html My (hopeful) thinking was that considering the $f->read() the Apache2::Filter object may also be a FileHandle, hence the attempt at binmode($f,..) But that seems to be incorrect. (And I don't see any (documented) method of Apache2::Filter that would return the underlying FileHandle either)