I have a Php
script that should extract latin1_swedish_ci
encoded Data from Mysql
database, the extracted data is then encoded with json_encode
method, everything works fine unless the extracted rows contains special characters like é è .....
, in that case i get no results, and and the HTML status code is 200
That is my function
public function categorie()
{
// Cross validation if the request method is GET else it will return "Not Acceptable" status
if($this->get_request_method() != "GET"){
$this->response('',406);
}
$sql = mysql_query("SELECT * FROM categorie", $this->db);
if(mysql_num_rows($sql) > 0)
{
$result = array();
while($rlt = mysql_fetch_array($sql,MYSQL_ASSOC)){
$result[] = $rlt;
}
// If success everythig is good send header as "OK" and return list of users in JSON format
$this->response($this->json($result), 200);
}
$this->response('',204); // If no records "No Content" status
}
private function json($data){
if(is_array($data)){
return json_encode($data);
}
}