I got something strange with my mySql database... My tables are encode in "utf8_unicode_ci", but when I make a SELECT on it, data seems not to be UTF8 because json_encode give an empty string.
I have to re browse the result to re-encode the data in UTF8...
$q = $this->db->prepare("SELECT ...");
$q->execute();
$data = $q->fetchAll();
foreach ($data as $key => $value) {
$data[$key] = utf8_encode($value);
}
return $data;
After that, json_encode do his job. But I don't understand why the SELECT result from my table encode in "utf8_unicode_ci" doesn't extract the data in UTF8 directly... It is very redundant to re-browse the array...
Thanks for help