/**
* Sanitize a text, repairing bad UTF8 entities.
* @param string $content
* @return string
*/
function sanitize($content) {

// … , …
$content = preg_replace('~\xC3\xA2\xE2\x82\xAC\xC2\xA6~', '…', $content);
$content = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x82\xC2\xA6~', '…', $content);
$content = preg_replace('~\xD0\xB2\xD0\x82\xC2\xA6~', '…', $content);

// — , —
$content = preg_replace('~\xC3\xA2\xE2\x82\xAC\xE2\x80\x9D~', '—', $content);
$content = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x82\xAC\xC2\x9D~', '—', $content);
$content = preg_replace('~\xD0\xB2\xD0\x82\xE2\x80\x9D~', '—', $content);

// – , –
$content = preg_replace('~\xC3\xA2\xE2\x82\xAC\xE2\x80\x9C~', '–', $content);
$content = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x82\xAC\xC5\x93~', '–', $content);
$content = preg_replace('~\xD0\xB2\xD0\x82\xE2\x80\x9C~', '–', $content);

// ’ , ’
$content = preg_replace('~\xC3\xA2\xE2\x82\xAC\xE2\x84\xA2~', '’', $content);
$content = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x80\x9E\xC2\xA2~', '’', $content);
$content = preg_replace('~\xD0\xB2\xD0\x82\xE2\x84\xA2~', '’', $content);
$content = preg_replace('~\xD0\xBF\xD1\x97\xD0\x85~', '’', $content);

// ‘ , ‘
$content = preg_replace('~\xC3\xA2\xE2\x82\xAC\xCB\x9C~', '‘', $content);
$content = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x8B\xC5\x93~', '‘', $content);

// ” , ”
$content = preg_replace('~\xC3\xA2\xE2\x82\xAC\xC2\x9D~', '”', $content);
$content = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x82\xC2\x9D~', '”', $content);
$content = preg_replace('~\xD0\xB2\xD0\x82\xD1\x9C~', '”', $content);

// “ , “
$content = preg_replace('~\xC3\xA2\xE2\x82\xAC\xC5\x93~', '“', $content);
$content = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x85\xE2\x80\x9C~', '“', $content);
$content = preg_replace('~\xD0\xB2\xD0\x82\xD1\x9A~', '“', $content);

// ™ , ™
$content = preg_replace('~\xC3\xA2\xE2\x80\x9E\xC2\xA2~', '™', $content);
$content = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x82\xAC\xC5\xBE\xC3\x82\xC2\xA2~', '™', $content);

// th
$content = preg_replace('~t\xC3\x82\xC2\xADh~', 'th', $content);

// .
$content = preg_replace('~.\xD0\x92+~', '.', $content);
$content = preg_replace('~.\xD0\x92~', '.', $content);

// ,
$content = preg_replace('~\x2C\xD0\x92~', ',', $content);

return $content;
}