PHP DOM DOCUMENT cannot load file -
all,
i trying load xml file dom, fails due following reason:
- presence of registered trademark
®
(r circle) in file.
basically, if shows trademark sign (r circle) dom fails load file.
the error displayed are:
encoder errorcdata section not finished premature end of data in tag elm line 12
when check encoding of file ascii. if physically remove character file, works fine.
i loading file using following code:
$xml_dom = new domdocument(); $xml_dom->preservewhitespace = false; $result = $xml_dom->load($file);
$result = ''
(empty) when fails. when remove trademark character , works, $result = 1
is there way ask dom ignore character? character supposed show if encoding ascii?. file not generated me, changing encoding @ point not option.... thank you!
try method:
$pagedom = new domdocument(); $searchpage = mb_convert_encoding($htmlutf8page, 'html-entities', "utf-8"); @$pagedom->loadhtml($htmlutf8page);
Comments
Post a Comment