static function fixMSEncoding($doc)
{
$paras = $doc->getElementsByTagName('p');
for ($i = $paras->length - 1; $i >= 0; $i--) {
$para = $paras->item($i);
if ($para->getAttribute('class') == 'MsoNormal') {
$fragment = $doc->createDocumentFragment();
$fragment->appendChild($doc->createTextNode($para->nodeValue));
$fragment->appendChild($doc->createElement('br'));
$new_node = $para->parentNode->replaceChild($fragment, $para);
}
}
$doc->loadHTML($doc->saveHTML());
return $doc;
}