From f5a87398433ebecefbc62d4fead8a178e32a1f26 Mon Sep 17 00:00:00 2001 From: "ctrlaltca@gmail.com" <> Date: Sat, 25 Jun 2011 12:23:51 +0000 Subject: reapplied patch for #106 since it seems like it's playing fine now. --- framework/Web/Javascripts/TJavaScript.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'framework/Web/Javascripts/TJavaScript.php') diff --git a/framework/Web/Javascripts/TJavaScript.php b/framework/Web/Javascripts/TJavaScript.php index 2efbea3a..2df16816 100644 --- a/framework/Web/Javascripts/TJavaScript.php +++ b/framework/Web/Javascripts/TJavaScript.php @@ -237,6 +237,15 @@ 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); @@ -250,6 +259,9 @@ 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