I have this URL: http://google.com and I urlencode it using this:
NSArray *escapeChars = [NSArray arrayWithObjects:@";" , @"/" , @"?" , @":" , @"@" , @"&" , @"=" , @"+" , @"$" , @"," , @"[" , @"]", @"#", @"!", @"'", @"(", @")", @"*", nil]; NSArray *replaceChars = [NSArray arrayWithObjects:@"%3B" , @"%2F" , @"%3F" , @"%3A" , @"%40" , @"%26" , @"%3D" , @"%2B" , @"%24" , @"%2C" , @"%5B" , @"%5D", @"%23", @"%21", @"%27", @"%28", @"%29", @"%2A", nil]; int len = [escapeChars count]; NSMutableString *temp = url; int i; for(i = 0; i < len; i++) { [temp replaceOccurrencesOfString: [escapeChars objectAtIndex:i] withString:[replaceChars objectAtIndex:i] options:NSLiteralSearch range:NSMakeRange(0, [temp length])]; } return temp; here is the encoded String I get:http0X1.D49C41C5D49CP-5700.0000000.000000google.com
How can that happen?
stringByAddingPercentEscapesUsingEncoding: