From 36d392b0de3b2b4eda9de9897ede51f354bb3d78 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 28 Jan 2012 16:58:52 +0100 Subject: [PATCH] fixed previous commit --- lib/Twig/Extension/Core.php | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 9d35ae1..829eb43 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -316,10 +316,12 @@ function twig_random(Twig_Environment $env, $values = null) $values = preg_split('/(? $value) { + $values[$i] = twig_convert_encoding($value, $charset, 'UTF-8'); + } } } else { - return substr($values, mt_rand(0, strlen($values)), 1); + return $values[mt_rand(0, strlen($values) - 1)]; } } -- 1.7.2.5