code :
#import "EncodeURLString.h"
@implementation EncodeURLString
- (NSString *)urlEncodeValue:(NSString *)str
{
NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)str, NULL, CFSTR("!*'\";$,#[] "), kCFStringEncodingUTF8);
return [result autorelease];
}
- (NSString *)safeEcapeString:(NSString *)str
{
NSString *result = [str stringByReplacingOccurrencesOfString:@":" withString:@"\\:"];
result = [result stringByReplacingOccurrencesOfString:@";" withString:@"\\;"];
result = [result stringByReplacingOccurrencesOfString:@"," withString:@"\\,"];
return [result autorelease];
}
@end
this code is causing the # tag in my url to be converted into %23 is there a way that i make it stop converting the hash tags? i’ve tried removing it from here CFSTR(“!*’\”;$,#[] “) but it doesn’t work it still converts it. any help or tips would be appreciated
Thanks
Remove the hash from the
legalURLCharactersToBeEscapedparameter and useCFSTR("#")forcharactersToLeaveUnescaped.