I\'m trying to parse some HTML using DOMDocument, but when I do, I suddenly lose my encoding (at least that is how it appears to me).
$profile = \"
You could prefix a line enforcing utf-8 encoding, like this:
utf-8
@$doc->loadHTML('' . "\n" . $profile);
And you can then continue with the code you already have, like:
$doc->saveXML()