From 8fcfadf79ebc05d43bf15e130a4fad04a3bbd6cf Mon Sep 17 00:00:00 2001 From: "Christophe.Boulain" <> Date: Mon, 23 Feb 2009 14:52:26 +0000 Subject: Fixed Issue#106 --- framework/Web/Javascripts/TJavaScript.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'framework/Web/Javascripts') diff --git a/framework/Web/Javascripts/TJavaScript.php b/framework/Web/Javascripts/TJavaScript.php index 2134c2d1..b36d5b40 100644 --- a/framework/Web/Javascripts/TJavaScript.php +++ b/framework/Web/Javascripts/TJavaScript.php @@ -210,6 +210,14 @@ class TJavaScript */ public static function jsonEncode($value) { + if (function_exists('json_encode')) + { + if (is_string($value) && + ($g=Prado::getApplication()->getGlobalization(false))!==null && + strtoupper($enc=$g->getCharset())!='UTF-8') + $value=iconv($enc, 'UTF-8', $value); + return json_encode($value); + } if(self::$_json === null) self::$_json = Prado::createComponent('System.Web.Javascripts.TJSON'); return self::$_json->encode($value); @@ -223,6 +231,8 @@ class TJavaScript */ public static function jsonDecode($value) { + if (function_exists('json_decode')) + return json_decode($value); if(self::$_json === null) self::$_json = Prado::createComponent('System.Web.Javascripts.TJSON'); return self::$_json->decode($value); -- cgit v1.2.3