I save innerHTML
of an element by
function innerHTML(DOMNode $el){
$html='';
foreach($el->childNodes as $node){
$temp=new DOMDocument();
$temp->appendChild($temp->importNode($node,true));
$html.=trim($t->saveHTML());
}
return (string)$html;
}
The problem is that it converts characters to HTML entities (–
, α
, etc).
The solution given here is to set the encoding when loading into the document as
$dom->loadHTML(mb_convert_encoding($profile, 'HTML-ENTITIES', 'UTF-8'));
but I do not load an HTML. The DOMDocument is just a temporary document for saving the imported nodes.