note 102178 modified in function.json-encode by danbrown

From: Date: Tue, 01 Feb 2011 13:59:34 +0000
Subject: note 102178 modified in function.json-encode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-176557@lists.php.net to get a copy of this message
json_encode() only works with UTF-8 charset. In case if you work with other charset, use this very simple solution instead of json_encode: <?php //$return_arr = the array of data to json encode //$out = the output of the function //don't forget to escape the data before use it! $out = '["' . implode('","', $return_arr) . '"]'; ?> --was-- json_encode() only works with UTF-8 charset. In case if you work with other charset, use this very simple solution instead of json_encode: //$return_arr = the array of data to json encode //$out = the output of the function //don't forget to escape the data before use it! $out = '["' . implode('","', $return_arr) . '"]'; http://php.net/manual/en/function.json-encode.php

« previous php.notes (#176557) next »