php - Unable to get hebrew results using JsonP -


i'm doing jsonp request php script hosted on website have. php script results db , return them json.

the problem db contains hebrew chars , them '??????' in response.

any idea how solve this?

here js code:

$.getjson("http://flyfish.co.il/appdiet?callback=?",function(data){ $('p').text(data[0].food_name); }); 

and php code:

 <?php header('content-type: text/html; charset=utf-8'); require_once 'config.php';  $mysqli = new mysqli(host,username,password,db_name);  $query = "select * mytable";  if ($result = $mysqli->query($query))  { $data = array(); while ($row = $result->fetch_assoc()) {      $data[] = $row;      } echo $_get['callback'].'('.json_encode($data).')'; }   else { echo $_get['callback'].'('.$mysqli->error.')'; }  $mysqli->close(); 

try adding set names 'utf8'; before select statement.


Comments