note 30971 added to ref.domxml
| From: | pbougrier at micropole-univers dot com | Date: | Fri, 04 Apr 2003 20:17:21 +0000 |
| Subject: | note 30971 added to ref.domxml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46234@lists.php.net to get a copy of this message | ||
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
--
http://www.php.net/manual/en/ref.domxml.php
http://master.php.net/manage/user-notes.php?action=edit+30971
http://master.php.net/manage/user-notes.php?action=delete+30971
http://master.php.net/manage/user-notes.php?action=reject+30971