开发者

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 开发者_如何学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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜