How to convert Unicode strings (\u00e2, etc) into NSString for display?

Posted by karlbecker_com on Stack Overflow See other posts from Stack Overflow or by karlbecker_com
Published on 2010-05-14T05:03:33Z Indexed on 2010/05/15 2:04 UTC
Read the original article Hit count: 266

Filed under:
|
|

I am trying to support arbitrary unicode from a variety of international users. They have already put a bunch of data into sqlite databases on their iPhones, and now I want to capture the data into a database, then send it back to their device. Right now I am using a php page that is sending data back to from an internet mysql database. The data is saved in the mysql database properly, but when it's sent back it comes out as unicode text, such as

Frank\u00e2\u0080\u0099s iPad

instead of just

Frank's iPad

where the apostrophe should really be a curly apostrophe.

The answer posted to another question indicates that there is no built-in Cocoa methods to convert the "\u00e2\u0080\u0099" portion of the unicode string from the webserver to an NSString object. Is this correct?

That seems really surprising (and scarily disappointing), since Cocoa definitely allows input from many different Unicode characters, and I need to support any arbitrary language that I have never heard of, and all of the possible characters. I save them to and from the local sqlite database just fine now, but once I send it to a web server, then perhaps pull down different data, I want to ensure the data pulled from the web server is correctly formatted.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa