AFNetworking/AFNetworking — Issue #209: Percent sign on POST parameter value causing it to pass (null) to server
Author: jpm
Created: 2012-02-18 01:04:33+00:00
State: open

Not sure what is wrong here, but I'm fairly certain that what I'm doing is correct. It's a simple POST back to the server with some parameters, one of them having a value that contains a percent sign.

Here's a simpler version of my code:

NSDictionary *apiParameters = [NSMutableDictionary dictionary];
[apiParameters setValue:entity_uuid forKey:@"entity_uuid"];
[apiParameters setValue:message forKey:@"desc"];

[[CustomAPIClient sharedClient] postPath:@"update-entity.json" parameters:apiParameters success:^(AFHTTPRequestOperation *operation, id responseObject) {

} failure:^(__unused AFHTTPRequestOperation *operation, NSError *error) {

}];

As you can see, nothing very fancy. The "message" variable contains something like this:

Testing again, 50% off.

The fact that the percent sign exists there turns the "desc" parameter into "(null)". If I remove the percent sign, the actual value gets encoded just right.

Seems like an encoding issue to me, but it just seems weird like nobody noticed this issue before.

Anything I'm doing wrong here?

--Joao