ios app pulls info from coredata and sends it to a web service (php) via POST along with simple variables like a userid.
userid comes through fine as does the raw json which looks like this
json string(607) "<5b7b226b 6579776f 72643122 3a226e61 76792073 65616c73 222c226e 616d6532 223a2262 6c6f7768 61726422 2c226e61 6d653122 3a226a6f 6520626c 6f77222c 22636974 79737461 7465223a 226e6170 6c65732c 20666c6f 72696461 222c226b 6579776f 72643222 3a227573 73206e65 77222c22 6b657977 6f726433 223a2272 6f746172 79227d2c 7b226b65 79776f72 6431223a 22636174 63686572 222c226e 616d6532 223a2254 6f6d6d79 222c226e 616d6531 223a2254 6f6d2054 68756d62 222c2263 69747973 74617465 223a2257 6573746d 696e7374 65722c20 4d617373 222c226b 6579776f 72643222 3a226669 7368696e 67222c22 6b657977 6f726433 223a2268 756e7469 6e67227d 5d>"
however, when I use json_decode, it returns null.
I've tried trimming, doing the substr, 3 trick, mb_convert_encoding($jsoninfo,'UTF-8','UTF-8'); and a few other fixes I've found here online but nothing is working.
Here is the xcode used to post
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsonArray options:0 error:&error];
NSString *post = [NSString stringWithFormat:@"uuid=%@&json=%@", UUID, jsonData];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
//Read the post length
NSString *postLength = [NSString stringWithFormat:@"%lu", (unsigned long)[postData length]];
//Make a new NSMutableURLRequest, and add the necessary URL, Headers and POST Body
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:@"http://www.website.com/mycode.php"]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded;charset=UTF-8" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
I am assuming it is a decoding issue in the php that I haven't figured out yet, but am I missing anything else here in xcode?