PHP: JSON output empty because of german char
<p>There are a lot of topics who discuss my problem but I cant still solve it.</p>

<p>I have a database which I encode by JSON. But when I put content with german char like ä, ö, ü etc the output is empty.</p>

<p>Here is my php script:</p>

<pre><code>&lt;?PHP
error_reporting(E_ALL);
ini_set('display_errors', '1');

//Verbindung zur Datenbank
include "inc_mysql.php";

//SQL-String
$select = "SELECT * FROM module ORDER BY name ASC";

//SQL-Befehl in Variable speichern
$sql = mysql_query($select);

//********************this one was missing!********************
mysql_set_charset("utf8");

//Array erstellen
$jsonArray = array();

while ($row = mysql_fetch_array($sql)){ 
    $jsonArray[] = $row;
}

echo json_encode($jsonArray, JSON_UNESCAPED_UNICODE);   
?&gt;
</code></pre>

<p><strong>The php file is UTF-8 without BOM.</strong></p>

<p><strong>The column is the dabase is utf8_general_ci.</strong></p>

<p>BTW: The error reporting just says something about mysql_query() is depricated.</p>

<p>Might be a easy game for you guys :)</p>

<p><strong>Solution found! Check the code!</strong> </p>