utf-8 conversion with mb_convert_encoding instead of bugged iconv

This commit is contained in:
Steffen Schröder 2014-06-26 10:57:37 +02:00
parent ec7f2f96d3
commit f2b9bc82ed

View File

@ -178,15 +178,6 @@ abstract class Formatter {
* @return string
*/
public static function utf8($text) {
if (!$text) {
return $text;
}
$value = @iconv('UTF-8', 'UTF-8//IGNORE', $text);
if (!$value) {
// Prevent bugged iconv() of some systems
$text = preg_replace('/[^[:print:]]/', '', $text);
$value = iconv('UTF-8', 'UTF-8//IGNORE', $text);
}
return $value;
return mb_convert_encoding($text, 'UTF-8');
}
}