title: Why would json_encode return an empty string
body: <p>I have a simple php structure with 3 nested arrays. </p>
  
  <p>I do not use particular objects and I build myself the arrays with 2 nested loops. </p>
  
  <p>Here is a sample of the var_dump of the array I want to convert to Json. </p>
  
  <pre><code>array (size=2)
    'tram B' =&gt; 
      array (size=2)
        0 =&gt; 
          array (size=3)
            'name' =&gt; string 'Ile Verte' (length=9)
            'distance' =&gt; int 298
            'stationID' =&gt; int 762
        1 =&gt; 
          array (size=3)
            'name' =&gt; string 'La Tronche Hôpital' (length=18)
            'distance' =&gt; int 425
            'stationID' =&gt; int 771
    16 =&gt; 
      array (size=4)
        0 =&gt; 
          array (size=3)
            'name' =&gt; string 'Bastille' (length=8)
            'distance' =&gt; int 531
            'stationID' =&gt; int 397
        1 =&gt; 
          array (size=3)
            'name' =&gt; string 'Xavier Jouvin' (length=13)
            'distance' =&gt; int 589
            'stationID' =&gt; int 438
  </code></pre>
  
  <p>In another script I have a similar structure and <code>json_encode</code> works fine. 
  So I don't understand why <code>json_encode</code> won't work here.</p>
  
  <p>Edit : there seems to be a problem with the encoding. When <code>mb_detect_encoding</code> returns ASCII, the <code>json_encode</code> works but when it returns UTF8, it doesn't work anymore.  </p>
  
  <p>Edit2 : <code>json_last_error()</code> returns <code>JSON_ERROR_UTF8</code> which means : <a href="http://fr2.php.net/manual/en/function.json-last-error.php" rel="noreferrer">Malformed UTF-8 characters, possibly incorrectly encoded</a>.</p>