switched to use mbstring whenever possible instead of iconv

This commit is contained in:
Fabien Potencier 2012-05-05 10:55:15 +02:00
parent dd0da03c8c
commit e193452742
2 changed files with 6 additions and 6 deletions

View File

@ -507,10 +507,10 @@ class PhpEngine implements EngineInterface, \ArrayAccess
*/
public function convertEncoding($string, $to, $from)
{
if (function_exists('iconv')) {
return iconv($from, $to, $string);
} elseif (function_exists('mb_convert_encoding')) {
if (function_exists('mb_convert_encoding')) {
return mb_convert_encoding($string, $to, $from);
} elseif (function_exists('iconv')) {
return iconv($from, $to, $string);
}
throw new \RuntimeException('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).');

View File

@ -134,10 +134,10 @@ class Unescaper
*/
private function convertEncoding($value, $to, $from)
{
if (function_exists('iconv')) {
return iconv($from, $to, $value);
} elseif (function_exists('mb_convert_encoding')) {
if (function_exists('mb_convert_encoding')) {
return mb_convert_encoding($value, $to, $from);
} elseif (function_exists('iconv')) {
return iconv($from, $to, $value);
}
throw new \RuntimeException('No suitable convert encoding function (install the iconv or mbstring extension).');