-1

Possible Duplicate:
String won't url encode in iOS

I am using ASIHttpRequest to send http request to my server. In Jquery I can construct a dictionary and just send the dictionary to jquery's ajax method, the Jquery will do the url encode things.

It looks like ASIHttp lacks of such API? Which API I can use to encode a dictionary(or other simple method) to a url encoded string?

1

1 Answer 1

1

You can use

- (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)enc; 

Example:

NSString* string = @"Hello, World"; NSString* encodedString = [string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.