Objective-C
Objective-C
URL Encoding and Decoding
Demonstrates URL encoding/decoding using the HTTP convenience methods.Chilkat Objective-C Downloads
#import <CkoHttp.h>
#import <NSString.h>
CkoHttp *http = [[CkoHttp alloc] init];
NSString *s = @"Hello World! 100% sure.";
NSString *encoded = [http UrlEncode: s];
NSLog(@"%@%@",@"URL encoded: ",encoded);
// Space → %20
// ! → %21
// % → %25
NSString *decoded = [http UrlDecode: encoded];
NSLog(@"%@%@",@"URL decoded: ",decoded);
// Output:
// URL encoded: Hello%20World%21%20100%25%20sure.
// URL decoded: Hello World! 100% sure.