Re: Bundling libxml2 default?
| From: | Adam Dickmeiss | Date: | Fri, 16 May 2003 21:32:07 +0000 |
| Subject: | Re: Bundling libxml2 default? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-1621@lists.php.net to get a copy of this message | ||
On Sat, May 17, 2003 at 06:11:02AM +0900, Moriyoshi Koizumi wrote:
> Could you try the attached patch and see if it works?
I did a similar thing, but it didn't made a difference. To
be 100% sure I applied your patch and tried again. No luck:(
The info for xmlCreatePushParserCtxt indicates that 4 leading
bytes are needed to detect decoding.
http://xmlsoft.org/html/libxml-parser.html#xmlCreatePushParserCtxt
-- Adam
>
> Moriyoshi
>
> Adam Dickmeiss <adam@indexdata.dk> wrote:
>
> > On Fri, May 16, 2003 at 07:00:32PM +0200, Adam Dickmeiss wrote:
> > > On Fri, May 16, 2003 at 11:20:53AM -0400, Sterling Hughes wrote:
> > [snip]
> > > > Err, that's not how it works in CVS at least:
> > > >
> > > > xml/compat.c - 279
> > > >
> > > > parser->parser->encoding = xmlStrdup(encoding);
> > > Yes. That's what it does . Question is, what it means
> > > for libxml2. Does it mean input encoding? Are you allowed
> > > to tamper with the encoding member in the parser struct at all?
> > > It could be that the encoding is _set_ by libxml2 to hold
> > > the actual encoding of the XML record.. We should check
> > > the libxml doc.
> > >
> > > I also noticed another issue with libxml. xml_parser_create
> > > fails for an XML record using UTF-16 encoding. That's
> > > even more strange, because libxml does support it. At least xmllint
> > > (part of libxml2) does not reject the XML file itself.
> >
> > I looked at this issue a little, and I think that libxml
> > refuses to decode UTF-16 files (in compat.c) is due to the fact
> > xmlCreatePushParserCtxt is not called with the leading 4 bytes
> > of the XML file. So my thought was that maybe it's best to defer
> > calling that function until XML_Parse is called the first time.
> >
> > XML_ParserCreate_MM would just do
> > parser->parser = 0;
> > to indicate that parser context is not yet there.
> >
> > I don't supply a patch, since it doesn't yet work. If anybody
> > has input on this issue that'd be nice.
> >
> > -- Adam
> >
> >
> >
> > --
> > PHP Internals - PHP Runtime Development Mailing List
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> Index: ext/xml/compat.c
> ===================================================================
> RCS file: /repository/php4/ext/xml/compat.c,v
> retrieving revision 1.6
> diff -u -r1.6 compat.c
> --- ext/xml/compat.c 7 May 2003 20:53:23 -0000 1.6
> +++ ext/xml/compat.c 16 May 2003 21:07:39 -0000
> @@ -276,7 +276,7 @@
> parser->mem_hdlrs.free_fcn(parser->parser);
> return NULL;
> }
> - parser->parser->encoding = xmlStrdup(encoding);
> + parser->parser->encoding = (encoding != NULL ? xmlStrdup(encoding) :
> XML_CHAR_ENCODING_NONE);
> if (sep != NULL) {
> parser->namespace = 1;
> parser->_ns_map = xmlHashCreate(10);
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Adam Dickmeiss mailto:adam@indexdata.dk http://www.indexdata.dk
Index Data T: +45 33410100 Mob.: 212 212 66