diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-12-11 16:53:54 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-12-11 16:53:54 +0000 |
| commit | 003b1d193f096c69d1fe92c916bf2543f829e7f2 (patch) | |
| tree | 0d5b656117d4f78ec25e31e8b00defc2110dc115 /roundcubemail/program/include/rcube_shared.inc | |
| parent | dfba922026ab5fdce33d84ae1be28b684ca63d38 (diff) | |
- use proper unicode cleanup for JSON, fixes #1486356
git-svn-id: https://svn.roundcube.net/trunk@3175 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_shared.inc')
| -rw-r--r-- | roundcubemail/program/include/rcube_shared.inc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/roundcubemail/program/include/rcube_shared.inc b/roundcubemail/program/include/rcube_shared.inc index f4c6f7126..547174b8a 100644 --- a/roundcubemail/program/include/rcube_shared.inc +++ b/roundcubemail/program/include/rcube_shared.inc @@ -510,7 +510,7 @@ function rc_utf8_clean($input) if (!is_string($input) || $input == '') return $input; - + // iconv/mbstring are much faster (especially with long strings) if (function_exists('mb_convert_encoding') && ($res = mb_convert_encoding($input, 'UTF8', 'UTF8'))) return $res; @@ -563,6 +563,21 @@ function rc_utf8_clean($input) return $out; } + +/** + * Convert a variable into a javascript object notation + * + * @param mixed Input value + * @return string Serialized JSON string + */ +function json_serialize($input) +{ + $input = rc_utf8_clean($input); + + return json_encode($input); +} + + /** * Explode quoted string * |
