I have been having some problem with the stringByAddingPercentEscapesUsingEncoding:
method.
Here\'s what happens:
When I try to use the method to conver
This happens when you're trying to encode to NSASCIIStringEncoding
a string with characters not supported by ASCII.
Make sure you're encoding to NSUTF8StringEncoding
, if the string can contain UTF8 characters or the method would return nil
.
For me, this:
NSString *s=[@"..City=Cl&PostalCode=Rh6 0Nt" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@"s=%@",s);
... outputs:
s=..City=Cl&PostalCode=Rh6%200Nt
You're most likely using the wrong encoding.