note 97051 added to class.domdocument
| From: | me at richardsnazell dot com | Date: | Tue, 30 Mar 2010 02:35:00 +0000 |
| Subject: | note 97051 added to class.domdocument | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-167517@lists.php.net to get a copy of this message | ||
After running into a problem with DomDocument and a UTF-8 encoded input string, a simple work-around
was to convert the input string to ISO-8859-1, run my DOM queries, then convert back to UTF-8:
$xhtml = 'a UTF-8 encoded string';
$xhtml = utf8_decode($xhtml); // convert UTF-8 string to ISO-8859-1
// doing some DOM manipulation here on $xhtml
$xhtml = utf8_encode($xhtml); // convert ISO-8859-1 string back to UTF-8
Not ideal - but it worked for me.
----
Server IP: 69.147.83.197
Probable Submitter: 203.31.198.126
----
Manual Page -- http://www.php.net/manual/en/class.domdocument.php
Edit -- https://master.php.net/note/edit/97051
Del: integrated -- https://master.php.net/note/delete/97051/integrated
Del: useless -- https://master.php.net/note/delete/97051/useless
Del: bad code -- https://master.php.net/note/delete/97051/bad+code
Del: spam -- https://master.php.net/note/delete/97051/spam
Del: non-english -- https://master.php.net/note/delete/97051/non-english
Del: in docs -- https://master.php.net/note/delete/97051/in+docs
Del: other reasons-- https://master.php.net/note/delete/97051
Reject -- https://master.php.net/note/reject/97051
Search -- https://master.php.net/manage/user-notes.php