From: Fabien Potencier Date: Sat, 5 May 2012 06:28:23 +0000 (+0200) Subject: switched to use mbstring whenever possible instead of iconv (because of issues with... X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=d661c2a2f654ba8f2bddeeac0b8a80dcd59649ab;p=konrad%2Ftwig.git switched to use mbstring whenever possible instead of iconv (because of issues with iconv and Japanese -- thanks @ganchiku for the tip) --- diff --git a/CHANGELOG b/CHANGELOG index 2354fd0..659cb71 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ * 1.8.0 (2012-05-08) + * switched to use mbstring whenever possible instead of iconv * enforced interface when adding tests, filters, functions, and node visitors from extensions * fixed a side-effect of the date filter where the timezone might be changed * simplified usage of the autoescape tag; the only (optional) argument is now the escaping strategy or false (with a BC layer) diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 37415ae..e9ce03f 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -825,15 +825,15 @@ function twig_escape_filter_is_safe(Twig_Node $filterArgs) return array('html'); } -if (function_exists('iconv')) { +if (function_exists('mb_convert_encoding')) { function twig_convert_encoding($string, $to, $from) { - return iconv($from, $to, $string); + return mb_convert_encoding($string, $to, $from); } -} elseif (function_exists('mb_convert_encoding')) { +} elseif (function_exists('iconv')) { function twig_convert_encoding($string, $to, $from) { - return mb_convert_encoding($string, $to, $from); + return iconv($from, $to, $string); } } else { function twig_convert_encoding($string, $to, $from)