I am using this PHP script
<?php
mysql_connect("blabla", "blabla", "blabla") or die(mysql_error());
mysql_select_db("blabla") or die(mysql_error());
$q=mysql_query("SELECT * FROM table ORDER BY id DESC");
while($e=mysql_fetch_assoc($q))
$output[]=$e;
print(json_encode($output));
mysql_close();
?>
The output is Json. In the mySQL database there are entries with "ü,ä, ö" (German) For entries containing an "ü, ä, ö" the value is "null". I cannot figure out what is the problem with these characters.
json_encodereturns not a string an error occured. Check if it returnsNULLand handle the error condition. To find out which error happened, usejson_last_error.echo mysql_client_encoding();after themysql_connect()line ref - it will tell you the client encoding use. Withmysql_set_charset('UTF8');you should be able to change it if it's not UTF8.json_encodeneeds UTF8 encoded data. But add in any case what the echo'ed value is.