title: Jquery Json output special characters issue
body: <p>So I'm working on a system to get the metatag from a webpage to get the info for a video embed from a link (like facebook does).</p>
  
  <p>I am also getting the title of the page and the description to prefill some fields. And here is where I have a problem, the description works fine because it is a textarea so i can use <code>.html()</code> but the title is an input so I can either use <code>.attr()</code> or <code>.val()</code> and the problem comes from special characters like (é à è ö ä ü).</p>
  
  <p>Here is my code that I'm using.</p>
  
  <p>This is my Jquery action script:</p>
  
  <pre><code>&lt;script type="text/javascript" charset="utf-8"&gt;     
  $(function(){
      $("#url").bind("change", function(){
          var url = $("#url").val();
          $.getJSON("/ajax/embed_video.php", { url: url }, function(json) {
              $(json.embed).appendTo("#feeds");
              $("#title").attr("value", json.title);
              $("#description").html(json.description);
           });
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>This is my php file for exporting the JSON data :</p>
  
  <pre><code>$url = $_GET['url'];
  $result = getUrlData($url); //this get the metadata from the url
  $description = $result['metaTags']['og:description']['value'];
  $title = $result['metaTags']['og:title']['value'];
  
  $img_name = basename($result['metaTags']['og:image']['value']);
  copy(''.$result['metaTags']['og:image']['value'].'', "../".$path_video_temp.$img_name);
  
  $embed = " "; //EMBED CODE
  
  $data = array('title' =&gt; $title,'description' =&gt; $description, 'embed' =&gt; $embed, 'img' =&gt; '/'.$path_video_temp.$img_name);
  
  header('Content-Type: application/json; Charset=UTF-8');
  echo json_encode($data);
  </code></pre>
  
  <p>When I have a title with any accent or any special character it prints out <code>&amp;eacute;</code> etc.</p>
  
  <p>I tried using <code>html_entity_decode</code> and <code>htmlspecialchars_decode</code></p>
  
  <p>I hope someone has an idea where is the problem.</p>
  
  <p>Thanks for your time and have a good day</p>
  
  <p>Joris</p>