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('...’...', ENT_COMPAT, <YOUR_CHARSET>, false)
should work for you.
精彩评论