Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:1335 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82284 invoked from network); 7 May 2003 09:43:04 -0000 Received: from unknown (HELO gamma) (213.150.43.10) by pb1.pair.com with SMTP; 7 May 2003 09:43:04 -0000 Received: from adam by gamma with local (Exim 3.35 #1 (Debian)) id 19DLS3-0004ly-00 for ; Wed, 07 May 2003 11:43:03 +0200 Date: Wed, 7 May 2003 11:43:03 +0200 To: internals@lists.php.net Message-ID: <20030507094303.GA7028@indexdata.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline User-Agent: Mutt/1.3.28i Subject: xml_parser_create patch From: adam@indexdata.dk (Adam Dickmeiss) --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I'd like to submit a small patch that allows xml_parser_create and xml_parser_create_ns (Expat version) to honor the encoding of an XML document (including UTF-16). This solves bug #23293. With this patch xml_parser_create now works identical to the libxml2 version of it (AFAIK). Note that this patch _may_ break applications that assumes ISO-8859-1 (or default encoding) for XML applications, but only if the application omitted a desired encoding for xml_parser_create. Applications that wish their XML parser to do decoding but want a specific target encoding can use option XML_OPTION_TARGET_ENCODING . -- Adam -- Adam Dickmeiss mailto:adam@indexdata.dk http://www.indexdata.dk Index Data T: +45 33410100 Mob.: 212 212 66 --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch =================================================================== RCS file: /repository/php4/ext/xml/xml.c,v retrieving revision 1.119 diff -u -r1.119 xml.c --- xml.c 6 May 2003 19:38:49 -0000 1.119 +++ xml.c 7 May 2003 09:40:09 -0000 @@ -1032,7 +1032,7 @@ } parser = ecalloc(sizeof(xml_parser), 1); - parser->parser = XML_ParserCreate(encoding); + parser->parser = XML_ParserCreate(argc >= 1 ? encoding : 0); parser->target_encoding = encoding; parser->case_folding = 1; parser->object = NULL; @@ -1088,7 +1088,7 @@ } parser = ecalloc(sizeof(xml_parser), 1); - parser->parser = XML_ParserCreateNS(encoding, sep[0]); + parser->parser = XML_ParserCreateNS(argc >= 1 ? encoding : 0, sep[0]); parser->target_encoding = encoding; parser->case_folding = 1; parser->object = NULL; --C7zPtVaVf+AK4Oqc--