开发者

App not displaying 'á' properly in a UILabel

开发者 https://www.devze.com 2023-02-21 20:03 出处:网络
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.

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

精彩评论

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