title: PHP not outputting special characters properly
body: <p>My query selects a row from my database and outputs in form of JSON to the browser, but I have encountered a problem that I can't twist my head around: whenever the row that's being selected by my query contains a special character such as "ö", "ä" or "å" the response from php becomes completely blank. Here is my query:</p>
  
  <pre><code>"SELECT email, firstname, lastname, phone, role FROM members WHERE id=? LIMIT 1"
  </code></pre>
  
  <p>I output it like this:</p>
  
  <pre><code>$data = array(
                      "email" =&gt; $email,
                      "firstname" =&gt; $firstname,
                      "lastname" =&gt; $lastname,
                      "phone" =&gt; $phone,
                      "role" =&gt; $role
                  );
                     echo json_encode($data);
                     exit();
  </code></pre>
  
  <p>If I manually replace a part of the output with a special character like this:</p>
  
  <pre><code>$data = array(
                      "email" =&gt; $email,
                      "firstname" =&gt; "Jörgen", &lt;-------------
                      "lastname" =&gt; $lastname,
                      "phone" =&gt; $phone,
                      "role" =&gt; $role
                  );
                     echo json_encode($data);
                     exit();
  </code></pre>
  
  <p>Then it outputs it properly. My <code>config.php</code> contains this:</p>
  
  <pre><code>header('Content-type: text/plain; charset=utf-8');
  </code></pre>
  
  <p>And my database collation is set to <code>utf8_general ci</code></p>