Reputation: 11
My app receives json from the server and stores some strings in Core Data. Then this string is displayed in uilabel inside uitableviewcell. The text contains special characters like "å. My problem is that the text is not displayed in the cell. However, it is well displayed in uilabel inside a simple UIView. In addition, the screen capture in xcode shows that the uilabel inside UITablViewCell contains text, but visually it is not visible.
Json parsed using NSJSONSerialization class.
How it looks for user: http://prntscr.com/d8f12e How it looks in screen capture: http://prntscr.com/d8f26w
Upvotes: 1
Views: 60
Reputation: 2419
I have an approach when you are accessing the string in tableView method cellForRowAtIndex then use in this way:
let jsonString = strFName?.cStringUsingEncoding(NSUTF8StringEncoding)
let jsonData = NSData(bytes: jsonString!, length: jsonString!.count)
cell.lbl_Name.text = String(data: jsonData, encoding: NSNonLossyASCIIStringEncoding)
From this type of parsing you will get the output as you want.
Upvotes: 1