|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-05-15 05:57 UTC] pipo at club dot idecnet dot com
I have found problems using documents with different encodings. When I add nodes from one document to another ($docAItem->add_child($docB->root()), if the flag encoding property of the target document has not been set when initially creating the document (using functions xmldoc, xmldocfile, etc., not setting the property manually with '$doc->encoding = "utf8"') then the encoding translation is not done. A possible workaround for this situation is to force the flag using dumpmem with the optional encoding flag set. ie: $docA = domxml_new_xmldoc(?1.0?); $docARoot = $docA->add_root(?root?); $docA = xmldoc($docA->dumpmem(0, ?UTF8?)); It looks like the encoding property of the DomDocument object can?t be set manually. Also, when creating a new DomDocument from scratch (with domxml_new_xmldoc) the encoding property should be set to UTF8 as a default, or allow a second optional parameter in the xmldoc function to set the proper encoding. byeer, pipo_ PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 06:00:01 2025 UTC |
Here is the main problem regarding this bug. If you want to enter data into your xml document that is encoding in iso-8859-0 because the encoding on your document is set to iso-8859-0, it screws up because the internal encoding is always set to utf-8. This is fine, but the input encoding is also always set to utf-8...if you want to enter iso8859-1 data into the tree, there should be an option to set the input encoding so that it converts it appropriately to utf-8. Otherwise, the user is forced to do iconv('ISO-8859-1', 'UTF-8', 'string') each time he/she wants to enter data into the document. I believe you should be able to set the expected input encoding and have it automatically convert it.