xml_parser_create patch

From: Date: Wed, 07 May 2003 09:43:03 +0000
Subject: xml_parser_create patch
Groups: php.internals 
Request: Send a blank email to internals+get-1335@lists.php.net to get a copy of this message
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

=================================================================== 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;
« previous php.internals (#1335) next »