title: json returns corrupted data
body: <p>I am playing with an api that just reads from my database and returns the data in json format. </p>
  
  <p>In phpMyAdmin the sentences are perfect (I used utf8_general to input a csv). Example:</p>
  
  <pre><code>    A line that uses 'r and special chars etc
  </code></pre>
  
  <p>But when I echo the json, I get this:</p>
  
  <pre><code>    A line that uses ///\\/\/\/r and special chars etc
  </code></pre>
  
  <p>First I got null object back so I used:</p>
  
  <pre><code>   mysql_set_charset('utf8', $link);
  </code></pre>
  
  <p>But I still get the corrupted data back.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Some more info:</p>
  
  <pre><code>mysql_set_charset('utf8',$link);
  
  /* grab the posts from the db */
  $query = "SELECT * FROM huren WHERE 1";
  
  $result = mysql_query($query,$link) or die('Errant query:  '.$query);
  
  // check row count 
  $amount = mysql_num_rows($result);
  
  /* create one master array of the records */
  $houses = array();
  if(mysql_num_rows($result)) {
      while($post = mysql_fetch_assoc($result)) {
          $houses[] = $post;
      }
  }
  
  /* output in necessary format */
  
      header('Content-type: application/json');
   $changed_json= str_replace('\\/', '/',json_encode(array('House'=&gt;$houses)));
  echo str_replace('\\\\', '\\',$changed_json);
  </code></pre>