<?php
header("Content-Type: text/html; charset=utf-8");
$charset1 = '<meta charset = "utf-8">';
$charset2 = '<meta http-equiv="content-type" content="text/html; charset=utf-8">';
$html = <<<L
<!DOCTYPE HTML>
<html>
<head>
<meta charset = "utf-8">
<meta name="description" content="Описание сайта">
</head>
<body id="5">
Hello, World!
</body>
</html>
L;
$html = str_replace($charset1, $charset2, $html);
$ob = new DOMDocument();
$ob->formatOutput = true;
$ob->loadHTML($html);
$str = str_replace($charset2, $charset1, $ob->saveHTML());
echo $str;
?>
Результат:

;) Красота