#32431 [NEW]: SimpleXML encoding
| From: | maka3d at yahoo dot com dot br | Date: | Wed, 23 Mar 2005 16:54:39 +0000 |
| Subject: | #32431 [NEW]: SimpleXML encoding | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-75761@lists.php.net to get a copy of this message | ||
From: maka3d at yahoo dot com dot br
Operating system: any
PHP version: 5.0.3
PHP Bug Type: Feature/Change Request
Bug description: SimpleXML encoding
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 bug report at http://bugs.php.net/?id=32431&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32431&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32431&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32431&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32431&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32431&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32431&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32431&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32431&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32431&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32431&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32431&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32431&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32431&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32431&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32431&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32431&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32431&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32431&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32431&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32431&r=mysqlcfg