其他语言

本类阅读TOP10

·基于Solaris 开发环境的整体构思
·使用AutoMake轻松生成Makefile
·BCB数据库图像保存技术
·GNU中的Makefile
·射频芯片nRF401天线设计的分析
·iframe 的自适应高度
·BCB之Socket通信
·软件企业如何实施CMM
·入门系列--OpenGL最简单的入门
·WIN95中日志钩子(JournalRecord Hook)的使用

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
quick lesson in using stream filters

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

Sara Golemon在新闻组发了一篇关于在PHP扩展中如何使用stream filters的文章,参考如下:

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 blah 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 at
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

 

 




相关文章

相关软件