note 68055 rejected from function.dom-domdocument-construct by didou

From: Date: Sat, 30 Dec 2006 03:05:31 +0000
Subject: note 68055 rejected from function.dom-domdocument-construct by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-121040@lists.php.net to get a copy of this message
Note Submitter: b dot schoppmeier at bas-consult dot de ---- 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.

« previous php.notes (#121040) next »