KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am pulling data from a website via NSURLConnection and stashing the received data away in an instance of NSMutableData . In the connectionDidFinishLoading delegate method the data is convert into a string with a call to NSString's appropriate method: NSString *result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] The resulting string turns out to be a null. If I use the NSASCIIStringEncoding , however, I do obtain the appropriate string, albeit with unicode characters garbled up as expected. The server's Content-Type header does not specify the UTF-8 encoding, but I have attempted a number of different websites with a similar scenario, and there string conversion happens just fine. It seems like the problem only pertains to the given web service but I have no clue why. On a side note, is pulling web pages and data from an API good practice, i.e. buffering the data, converting into a string, and manipulating the string afterwards? Much appreciated!
Tags (comma-separated)
Save Edits
Cancel