0

I have a web database of text, that I'm packing and sending to an iPhone app via an SQLite3 db. There are a whole bunch of HTML entities in it, like ©. Right now I'm displaying the text on the iPhone via a resizing UILabel embedded in a UIScrollView. However, the characters are just showing up as their literal strings, not their characters. What is the most elegant way to get them to show? If necessary I can preconvert the data with PHP before I package the SQLite db.

Thanks!

Josh
  • 12,448
  • 10
  • 74
  • 118
  • 2
    the right term for things like "©" is "HTML entity". and yes, you probably ought to preconvert them. I've done it in Python, and it may be possible to do with PHP as well. – jcomeau_ictx May 26 '11 at 15:40

3 Answers3

3

PHP has a function to do this called html_entity_decode() ( http://www.php.net/manual/en/function.html-entity-decode.php )

horatio
  • 1,426
  • 8
  • 7
2

© is something of HTML, not an ASCII character in any way. You need to convert them to something the iPhone app can use, either on the iPhone or using the script that generates the database.

Antwan van Houdt
  • 6,989
  • 1
  • 29
  • 52
1

check out https://github.com/mwaterfall/MWFeedParser/blob/master/Classes/NSString+HTML.m from Converting & to & in Objective-C

Community
  • 1
  • 1
jcomeau_ictx
  • 37,688
  • 6
  • 92
  • 107