Getting ’ instead of an apostrophe(‘) in PHP

To convert to HTML entities:

<?php
  echo mb_convert_encoding(
    file_get_contents('http://www.tvrage.com/quickinfo.php?show=Surviver&ep=20x02&exact=0'),
    "HTML-ENTITIES",
    "UTF-8"
  );
?>

See docs for mb_convert_encoding for more encoding options.

Leave a Comment