Handling of document encoding seems to be inconsistent:
I created a document, loaded a HTML file, tweaked it a bit and pushed it to the browser as in
$doc = new DOMDocument();
$doc->loadHTML($file);
/*
manipulate the document
/*
$outString = $doc->saveXML();
Text from the HTML file was ruined if it contained umlauts.
Creating the document with
$doc = new DOMDocument("1.0","ISO-8889-1");
solved this problem.
But, when I set attributes to DOMElements where the attribute value contained umlauts those values still
appeared ruined.
Explicitly converting the attribute value to utf-8 as in
$element->setAttribute($name, utf8_encode($value));
solved that problem too.