function safe_utf8_encode($text, $charset) { if (strtolower($charset) == 'utf-8') { if (!acajoom_mail::seems_utf8($text)) { $text = utf8_encode($text); } } $text = acajoom_mail::acaHtmlEntityDecode($text, null, 'utf-8'); return $text; }