I'm using CakePHP to output an array that contains several UTF-8 encoded strings. I have a layout set up for the output (it's a REST API method):
<?php.
header("Pragma: no-cache");.
header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate");.
header('Content-Type: application/json; charset=UTF-8');.
header("X-JSON: ".$content_for_layout);.
echo $content_for_layout;.
?>
This is my view:
<?php echo json_encode($items); ?>
My database table where I get the data is encoded in utf-8. But when I output the data if one of its elements has special characters like à, á, etc, the string will be set to null in the JSON array. How can I properly output my data?