Reputation: 14835
What is the opposite of this:
modifiedTitle = [modifiedTitle stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
so that it makes a %20 appear as a space and a %26 appear as a &.
Upvotes: 2
Views: 1166
Reputation: 2741
This is the alternative:
NSString *url = [modalData.imageURL stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]];
There are other character set too in docs.
Upvotes: 0
Reputation: 243156
Man... if only the two relevant methods were listed right next to each other in the documentation....
Upvotes: 9
Reputation: 43330
All web-URL's are encoded some way some how. The most common of these is UTF-8. You can peruse the Encoding Standards, but know that %20 is a space and %26 is an ampersand in UTF-8, so use [myString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
to get rid of it.
Upvotes: 0
Reputation: 7346
The API you're looking for is stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding
.
Upvotes: 5