I received an NSMutableData from a server and now I want to convert it to an NSString. Any ideas about how to do this?
Asked
Active
Viewed 3.5k times
1 Answers
79
You can use the initWithData:
initializer:
[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
Change the encoding to that of the source data.

codelogic
- 71,764
- 9
- 59
- 54
-
35If he's getting data from a server he very likely wants NSUTF8StringEncoding instead. – Kendall Helmstetter Gelner Feb 28 '09 at 18:41