summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorChristophe.Boulain <>2009-02-23 14:52:26 +0000
committerChristophe.Boulain <>2009-02-23 14:52:26 +0000
commit8fcfadf79ebc05d43bf15e130a4fad04a3bbd6cf (patch)
treeccfe60644476b31b715a01bc1c0b957a9de952bd /framework
parentc025ec70132aa3d5194213b38377a3a9686ed0ff (diff)
Fixed Issue#106
Diffstat (limited to 'framework')
-rw-r--r--framework/Web/Javascripts/TJavaScript.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/framework/Web/Javascripts/TJavaScript.php b/framework/Web/Javascripts/TJavaScript.php
index 2134c2d1a..b36d5b401 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);