0

i have a UITableview, in the tableview i'm grabbing a JSON feed. But sometimes it's displaying htmlcharacters like “ instead of does anyone know how i can convert this in xcode?

Can i set a encoding for my textlabel?

[[cell textLabel]  setText:[item objectForKey:@"title" ]];
Jones
  • 375
  • 7
  • 23

1 Answers1

0

When I'm fetching strings from a web server and if they're destined for any User Interface, I usually de-louse (errr, de-percent-escape them) via this "NSString" method:

stringByReplacingPercentEscapesUsingEncoding (documentation linked for you).

This gets rid of the URL encoded pieces of strings.

Now, as to the HTML characters like "&#8220", that requires an additional NSString category to do some work.

And other people have already written this category for you. Take a look at the various answers here and one of them should work well.

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215