Quick lesson in using stream Filters

Source: Internet
Author: User

Sara golemon posted an article in The newsgroup about how to use stream filters in PHP extensions. The reference is as follows:

If all you want to do is use an already implemented one just do this:

Php_stream * stream;
Php_stream_filter * filter;
Zval * arguments = NULL;/* populate this with value (s) appropriate to the filter */

Stream = php_stream_open_wrapper (... blah .....);
Filter = php_stream_filter_create ("filtername", arguments, php_stream_is_persistent (Stream) tsrmls_cc );
/* Or & stream-> writefilters as appropriate */
Php_stream_filter_append (& stream-> readfilters, filter );

/* Of course, in the real world you'll want to check both stream and filter for null as they may have failed to instantiate */

That said, I don't think iconv. * will be any help. It only covers
Base64 _ (EN | de) code () and quoted_printable _ (EN | de) code ().

Filter Implementation is a bit trickier. Take a look
EXT/standard/filters. C for more info on that. If you come up with a UTF
Converter, I'm sure it can be added to the standard set of filters.

-Sara

"L0t3k" <cshmoove @ xxxxxxxxxxxxx> wrote in message
News: 20040823142259.47665.qmail @ xxxxxxxxxxxxxxx
> Can anyone give a hint as to how to use stream filters from an extension?
>
> I have to parse input files which may be in a variety of encodings (mainly
> Utf8), and processing is done internally in utf16.
>
> I noticed that there is an iconv filter, but I havent a clue (even after
> Googling) of how to use it.
>
> L0t3k

--
PHP internals-PHP runtime development mailing list
To unsubscribe, visit: http://www.php.net/unsub.php

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.