App not displaying 'á' properly in a UILabel
Why does my app draw 'á' as 'á' in a UILabel.
I parse the text off a webpage and then draw the text into 开发者_如何学JAVAa label.
Is there something I am missing?
Many Thanks -Code
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.
精彩评论