utf-8 conversion with mb_convert_encoding instead of bugged iconv
This commit is contained in:
parent
ec7f2f96d3
commit
f2b9bc82ed
@ -178,15 +178,6 @@ abstract class Formatter {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function utf8($text) {
|
public static function utf8($text) {
|
||||||
if (!$text) {
|
return mb_convert_encoding($text, 'UTF-8');
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user