#32431 [Opn->WFx]: SimpleXML encoding

From: Date: Wed, 23 Mar 2005 17:04:41 +0000
Subject: #32431 [Opn->WFx]: SimpleXML encoding
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-75762@lists.php.net to get a copy of this message
ID: 32431 Updated by: derick@php.net Reported By: maka3d at yahoo dot com dot br -Status: Open +Status: Wont fix Bug Type: Feature/Change Request Operating System: any PHP Version: 5.0.3 New Comment: This will not be changed until we have proper unicode support. All XML extensions behave currently like this. Previous Comments: ------------------------------------------------------------------------ [2005-03-23 17:54:38] maka3d at yahoo dot com dot br Description: ------------ SimpleXML store data internally as UTF-8, which is bad if you need iso-8859-1. A good solution is the same used by xml_parser_set_option. ex: xml_parser_set_option($xp,XML_OPTION_TARGET_ENCODING,'iso-8859-1') // This is what we have today $sxml = simplexml_load_string($xmlstr); //$sxml = simplexml_import_dom($dom); var_dump($sxml->asXML()); // OK echo utf8_decode($sxml->menu->historico); $internalEncoding = 'iso-8859-1'; $sxml = simplexml_load_string($xmlstr, $internalEncoding); //$sxml = simplexml_import_dom($dom); var_dump($sxml->asXML()); // OK echo $sxml->menu->historico; // now, no need of utf8_decode ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32431&edit=1

« previous php.bugs (#75762) next »