NSMutableUrlRequest eats plus signs

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-03-22T10:19:38Z Indexed on 2010/03/22 10:21 UTC
Read the original article Hit count: 401

I create NSMutableUrlRequest for sending data to server, add all necessary fields to it and then add the string for sending like this:

[theRequest setHTTPBody:[postString dataUsingEncoding: NSUTF8StringEncoding]];

postString is a usual NSString.

The problem is, when I receive this request at the server, all the plus (+) signs disappear from the http body. So if I had "abcde+fghj" on iPhone, I get "abcde fghj" on the server".

Can this be some encoding problem from using dataUsingEncoding: NSUTF8StringEncoding? Or some NSMutableUrlRequest stripping feature? What can I do to make it stop stripping plus signs? I need to receive UTF8 strings at the server side.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about nsmutableurlrequest