If I encode a string like this:
var escapedString = originalString.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)
it does
Swift 3:
let allowedCharacterSet = (CharacterSet(charactersIn: "!*'();:@&=+$,/?%#[] ").inverted) if let escapedString = originalString.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet) { //do something with escaped string }