Is there a simple way to escape a NSString so I can use it in a HTTP POST request?
I've tried stringByAddingPercentEscapesUsingEncoding
, but the following:
[@"~!@#$%^&*()-+\"'" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
gives me:
~!@%23$%25%5E&*()-+%22'
which is not usable in a HTTP POST query because the &
is left unescaped; therefore the other end interprets whatever follows it as another argument.