I am getting null character in the middle of the string obtained as a part of response to HTTP Post. As a result the content gets printed only upto the null character even though the string has more data in it. Below is the sample code that illustrates the problem
NSString *testString= @"v1db1���������¿¿sssss"; ->this line shows the null character warning
NSInteger stringlength = [testString length];
NSLog(@"String Length:%ld",stringlength);
NSLog(@"String Value:%@",testString);
Note: the test string contains a null character with the question mark. For some reason I am not able to save the post if I copy the exact string.
The first line shows a warning "Null character(s) preserved in string literal" in Xcode.
The output of this program is
String Length:21
String Value:v1db1
What is the correct approach to solve this problem?. I am thinking of scanning the NSString for any null character and removing the same. What could be the reason I am getting null character ?.