开发者

Some quotes are HTML entities, some aren't- fixing with PHP

I'm pulling text from Wordpress posts that has some escaped quotes like

Aunt Maude’s

and some with unescaped unicode quotes, like

Legen开发者_如何转开发d’s American Grill

I need to format the text into a plist to be displayed in an iOS app. htmlentities escapes the ampersands in the first example, like

Aunt Maude’s

so I've tried decoding everything, then encoding it, but html_entity_decode has no effect. Also, htmlentities changes the quotes to ’ which the plist parser doesn't like.

I don't really know what I'm doing here- any help?


htmlentities()'s last parameter allows you not to re-encode entities that have already been encoded, so

htmlentities('...&#8217;...', ENT_COMPAT, <YOUR_CHARSET>, false)

should work for you.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜