Re: Bundling libxml2 default?

From: Date: Fri, 16 May 2003 21:11:02 +0000
Subject: Re: Bundling libxml2 default?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-1620@lists.php.net to get a copy of this message
Could you try the attached patch and see if it works? 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);
« previous php.internals (#1620) next »