Getting ’ instead of an apostrophe(') in PHP

前端 未结 14 924
慢半拍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:37

    We had success going the other direction using this:

    mb_convert_encoding($text, "HTML-ENTITIES", "ISO-8859-1");
    
    0 讨论(0)
  • 2020-11-27 03:40

    Make sure your html header specifies utf8

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    

    That usually does the trick for me (obviously if the content IS utf8).

    You don't need to convert to html entities if you set the content-type.

    0 讨论(0)
提交回复
热议问题