I have some problem here
$source = "<html><body><h1>“</h1></body></html>";
$dom = new DOMDocument();
$dom->loadHTML($source);
echo $dom->saveHTML();
Output:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body><h1>“</h1></body></html>
Ok, this work correctly. But if I want to extract the nodes like this
$source = "<html><body><h1>“</h1></body></html>";
$dom = new DOMDocument();
$dom->loadHTML($source);
$h1 = $dom->getElementsByTagName('h1');
echo $dom->saveHTML($h1->item(0));
It output unrecognized text.
<h1>“</h1>
Anyone know how to solve this?