cvs: pear-core /PEAR XMLParser.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Fri, 11 Jul 2008 20:35:38 +0000 |
| Subject: | cvs: pear-core /PEAR XMLParser.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-7631@lists.php.net to get a copy of this message | ||
dufuz Fri Jul 11 20:35:38 2008 UTC
Modified files:
/pear-core/PEAR XMLParser.php
Log:
support lowercase utf-8 and also single quotes, the PHP 4 detection and strpos is fugly but well,
beats a preg
http://cvs.php.net/viewvc.cgi/pear-core/PEAR/XMLParser.php?r1=1.16&r2=1.17&diff_format=u
Index: pear-core/PEAR/XMLParser.php
diff -u pear-core/PEAR/XMLParser.php:1.16 pear-core/PEAR/XMLParser.php:1.17
--- pear-core/PEAR/XMLParser.php:1.16 Fri Jul 11 20:16:14 2008
+++ pear-core/PEAR/XMLParser.php Fri Jul 11 20:35:38 2008
@@ -16,7 +16,7 @@
* @author Stephan Schmidt (original XML_Unserializer code)
* @copyright 1997-2008 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: XMLParser.php,v 1.16 2008/07/11 20:16:14 dufuz Exp $
+ * @version CVS: $Id: XMLParser.php,v 1.17 2008/07/11 20:35:38 dufuz Exp $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a1
*/
@@ -88,12 +88,19 @@
$this->_depth = 0;
if (version_compare(phpversion(), '5.0.0', 'lt')) {
- if (strpos($data, 'encoding="UTF-8"')) {
+ if (
+ strpos($data, 'encoding="UTF-8"')
+ || strpos($data, 'encoding="utf-8"')
+ || strpos($data, "encoding='UTF-8'")
+ || strpos($data, "encoding='utf-8'")
+ ) {
$data = utf8_decode($data);
}
$xp = xml_parser_create('ISO-8859-1');
} else {
- if (stripos($data, 'encoding="UTF-8"')) {
+ if (stripos($data, 'encoding="UTF-8"')
+ || stripos($data, "encoding='UTF-8'")
+ ) {
$xp = xml_parser_create('UTF-8');
} else {
$xp = xml_parser_create('ISO-8859-1');