#32431 [WFx]: SimpleXML encoding
| From: | maka3d at yahoo dot com dot br | Date: | Fri, 01 Apr 2005 11:44:50 +0000 |
| Subject: | #32431 [WFx]: SimpleXML encoding | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76158@lists.php.net to get a copy of this message | ||
ID: 32431
User updated by: maka3d at yahoo dot com dot br
Reported By: maka3d at yahoo dot com dot br
Status: Wont fix
Bug Type: Feature/Change Request
Operating System: any
PHP Version: 5.0.3
New Comment:
"proper unicode support"
What does this mean? It will take to long? Depends on PHP, or some
external lib?
Previous Comments:
------------------------------------------------------------------------
[2005-03-23 18:04:40] derick@php.net
This will not be changed until we have proper unicode support. All XML
extensions behave currently like this.
------------------------------------------------------------------------
[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