Fallback from iconv to mbstring for encoding convertion
In some exotic environnement (IBM AIX) it may happens that `//TRANSLIT` is not supported. In that case iconv would return false. We can easily identify the case and fallback on mbstring instead. That should give correct result. Closes #135 Closes #136
This commit is contained in:
parent
8fd1825d39
commit
67581a0dd5
|
@ -468,7 +468,10 @@ class StringHelper
|
||||||
public static function convertEncoding($value, $to, $from)
|
public static function convertEncoding($value, $to, $from)
|
||||||
{
|
{
|
||||||
if (self::getIsIconvEnabled()) {
|
if (self::getIsIconvEnabled()) {
|
||||||
return iconv($from, $to . '//IGNORE//TRANSLIT', $value);
|
$result = iconv($from, $to . '//IGNORE//TRANSLIT', $value);
|
||||||
|
if (false !== $result) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mb_convert_encoding($value, $to, $from);
|
return mb_convert_encoding($value, $to, $from);
|
||||||
|
|
Loading…
Reference in New Issue