note 30971 deleted from ref.domxml by sniper
| From: | sniper@php.net | Date: | Mon, 03 Nov 2003 15:46:53 +0000 |
| Subject: | note 30971 deleted from ref.domxml by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59704@lists.php.net to get a copy of this message | ||
Note Submitter: pbougrier@micropole-univers.com
----
If you use another encoding than UTF-8, the API seems to bug with conversion errors. Forget it, just
follow the rules, for example with ISO-8859-1 encoding :
// you can't specify an encoding with domxml_new_doc(),
// so do it with domxml_open_mem() or domxml_open_file()
$dom = domxml_open_mem('<?xml version="1.0"
encoding="ISO-8859-1"?><déjà-vu/>');
// to have a clean DOM doc, remove the root node with :
$dom->remove_child($dom->document_element());
// now put my ISO-8859-1 element :
$elt = $dom->create_element(utf8_encode("a_new_déjà-vu"));
$dom->append_child($elt);
// ... and read it :
echo utf8_decode($elt->node_name());
// the dump works fine :
echo $dom->dump_mem();
more details on http://xmlsoft.org/encoding.html