Hi,
I have utf8 encoded nsdata from windows server. I want to convert it to nsstring for iphone. Since data contains characters(like degree symbol) which have different values on both platforms, how do I convert data to string.
Hi,
I have utf8 encoded nsdata from windows server. I want to convert it to nsstring for iphone. Since data contains characters(like degree symbol) which have different values on both platforms, how do I convert data to string.
NSString* newStr = [[NSString alloc] initWithData:theData
encoding:NSUTF8StringEncoding];
If the data is null-terminated, you should instead use
NSString* newStr = [NSString stringWithUTF8String:[theData bytes]];