removing strange characters from php string

前端 未结 14 1089
忘了有多久
忘了有多久 2021-01-31 17:45

this is what i have right now

Drawing an RSS feed into the php, the raw xml from the rss feed reads:

Paul’s Confidence

The ph

14条回答
  •  半阙折子戏
    2021-01-31 18:35

    Super simple solution is to have the characters decoded when the page is loaded

    Simply copy/paste the following at the beginning of the script

     header('Content-Type: text/html; charset=UTF-8');
    
     mb_internal_encoding('UTF-8');  
     mb_http_output('UTF-8'); 
     mb_http_input('UTF-8');  
     mb_regex_encoding('UTF-8');
    

    Reference: http://php.net/manual/en/function.mb-internal-encoding.php comment left by webfav at web dot de

提交回复
热议问题