2 // vim: foldmethod=marker
6 * @author Yoshinari Takaoka <takaoka@beatcraft.com>
7 * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
12 // {{{ Ethna_View_Json
16 * @author Yoshinari Takaoka <takaoka@beatcraft.com>
20 class Ethna_View_Json extends Ethna_ViewClass
32 * @param array $encode_param 出力するJSONにエンコードする値
34 function preforward($encode_param = array())
36 $client_enc = $this->ctl->getClientEncoding();
37 if (mb_enabled() && strcasecmp('UTF-8', $client_enc) != 0) {
38 mb_convert_variables('UTF-8', $client_enc, $encode_param);
40 $encoded_param = json_encode($encode_param);
42 $this->header(array('Content-Type' => 'application/json; charset=UTF-8'));