开发者

Remove the diamond question mark from the echoed content of a UTF-8 RSS feed

this is the header of all the RSS feeds I use

<?xml version="1.0" encoding="UTF-8"?>

and this is the encoding in my script

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
开发者_JAVA技巧

What I do is to display the content(description) of an RSS post using this echo mb_substr($entry->description, 0, 490); but I have a diamond question mark at the end of some descriptions not all.

If I echo the whole description value, I don't get any question marks at the end. I have made a lot of researching and found nothing that works for me as a fix. So, is there any possible working way to fix this or perhaps an alternative way to "cut" some of the echoed content?

Thank you.


Indicate the encoding with:

mb_substr($entry->description, 0, 490, "UTF-8");

Otherwise, the mbstring extension may assume a different encoding and treat the text in a fashion that corrupts the output.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜