I received an NSMutableData from a server and now I want to convert it to an NSString. Any ideas about how to do this?
+9
A:
You can use the initWithData:
initializer:
[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
Change the encoding to that of the source data.
codelogic
2009-02-27 03:22:05
If he's getting data from a server he very likely wants NSUTF8StringEncoding instead.
Kendall Helmstetter Gelner
2009-02-28 18:41:05