How Pass Options To Json_Encode In Cjavascript::jsonencode

i successfully can get json from active records but i need to pass option JSON_UNESCAPED_UNICODE

$r = Books::model()->findAll($c);

echo CJavaScript::jsonEncode($r);

as example above give bad utf-8 output for non english chars

PHP json_encode doesn’t work. so far i see only option to traverse array by my self and make simple objects.


so far i made a workaround for myself (for current question and this ) but that’s workaround…

		$c = new CDbCriteria(); 

		$c->select = ['created_date', 'book_guid', 'title', 'year'];


		$r = Books::model()->findAll($c);


		$ro = [];		

		if (is_array($r))


			foreach ($r as $o) {

				$ro_ = new stdClass();

				foreach ($c->select as $col) {

					$ro_->$col = ($col === 'created_date') ? 

						(new DateTime($o->$col))->format('Y-m-d') : 



				$ro[] = $ro_;



		// <----------

echo json_encode($ro, JSON_UNESCAPED_UNICODE);