Created
July 2, 2009 19:21
-
-
Save seth/139656 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSString+URLParamEncode.m | |
// EvriApi | |
// | |
// Created by Seth Falcon on 7/2/09. | |
// Copyright 2009 __MyCompanyName__. All rights reserved. | |
// | |
#import "NSString+URLParamEncode.h" | |
@implementation NSString (URLParamEncode) | |
+ (NSString *)stringWithURLParamEncoding:(NSString *)rawParam { | |
CFStringRef toEscape = (CFStringRef)@"!*'();:@&=+$,/?%#[]"; | |
NSString *encoded = | |
(NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, | |
(CFStringRef)rawParam, | |
NULL, | |
toEscape, | |
kCFStringEncodingUTF8); | |
return [encoded autorelease]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment