diff options
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | framework/Web/Javascripts/TJavaScript.php | 10 |
2 files changed, 12 insertions, 0 deletions
@@ -3,8 +3,10 @@ BUG: URL wildcard patterns didn't work with subfolders BUG: Issue#87 - TinyMCE : empty string disapears after encoding JS, that's a problem! (Christophe) BUG: Issue#96 - THttpResponse::redirect don't send status code (Christophe) BUG: Issue#107 - typo in TDbConnection::getCharset() (Christophe) +ENH: Issue#106 - TJavaScript::jsonEncode and TJavaScript::jsonDecode should use built-in PHP functions (Christophe) ENH: Issue#115 - Registry for Prado generated clientside counterparts of serverside controls (Yves Berkholz) ENH: Added caching of message files to TException (Michael) +ENH: Updated to scriptaculous 1.8.2 & Prototype 1.6.0.3 Version 3.1.4 January 11, 2009 BUG: Issue#9 - Global page properties are ignored when using external configuration (Christophe) 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);
|