user440096
user440096

Reputation:

App not displaying 'á' properly in a UILabel

Why does my app draw 'á' as '&aacute' in a UILabel.

I parse the text off a webpage and then draw the text into a label.

Is there something I am missing?

Many Thanks -Code

Upvotes: 0

Views: 452

Answers (1)

John Parker
John Parker

Reputation: 54445

This is because the data in the web page is HTML entity encoded so that á is expressed asá. However, as the UILabel doesn't parse/display HTML, it simply displays the content as-is.

As such, you'd need to entity decode the data (to convert á back to á) prior to displaying it. The existing HTML character decoding in Objective-C / Cocoa Touch question/answers (and other questions it links to) should be of some assistance.

Upvotes: 2

Related Questions