Getting ’ instead of an apostrophe(') in PHP

前端 未结 14 989
慢半拍i
慢半拍i 2020-11-27 02:38

I\'ve tried converting the text to or from utf8, which didn\'t seem to help.

I\'m getting:

\"It’s Getting the Best of Me\"

It sho

14条回答
  •  北海茫月
    2020-11-27 03:35

    For fopen and file_put_contents, this will work:

    str_replace("’", "'", htmlspecialchars_decode(mb_convert_encoding($string_to_be_fixed, "HTML-ENTITIES", "UTF-8")));
    

提交回复
热议问题