I just learned the hard way that you cannot pass special characters through NSURL. I am in need of a function that will help me pass characters like "&, %, ", ñ" and others via NSURL and NSData.
My code is below. You can see below that I replace the line breaks (\n) and spaces with %20. Is there a function or simple way I can have the types of characters listed above pass through NSURL? Any help would be great! Thank you!
NSString *var1_pre = [myTextView.text stringByReplacingOccurrencesOfString:@" "
withString:@"%20"];
NSString *var1 = [var1_pre stringByReplacingOccurrencesOfString:@"\n" withString:@"%20"];
NSString *strURL = [NSString stringWithFormat:@"http://www.website.com/page.php?
var1=%@",var1];
NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]];