public static function utf8Encode($string) { if (owa_lib::checkForUtf8($string)) { return $string; } else { if (function_exists('iconv')) { return iconv('UTF-8', 'UTF-8//TRANSLIT', $string); } else { // at least worth a try return utf8_encode($string); } } }