Q: How to HTTP encode a URL string with special characters in iOS? (Swift/ObjC) I have an url like this:
http://mywebsite.net/User/UserInfo?key=123&userId=456&json=[{"UserName":"user@gmail.com","Password":"","Test":"item","projectId":"123","ItemsJSON":[{"Id":10,"Id2":0,"Quantity":5}]
How do I make this url work in a NSURL. I will call UIApplication.sharedApplication().openURL
I tried doing:
let encodedString = sender.url.stringByAddingPercentEncodingWithAllowedCharacters(.URLUserAllowedCharacterSet())!

But I ended up with:
http%3A%2F%2Fmywebsite.net%2FUser%2FUserInfo%3Fkey=123&userId=456&json=%5B%7B%22UserName%22%3A%22user%40gmail.com%22,%22Password%22%3A%22%22,%22Test%22%3A%22item%22,%22projectId%22%3A%22123%22,%22ItemsJSON%22%3A%5B%7B%22Id%22%3A10,%22Id2%22%3A0,%22Quantity%22%3A5%7D%5D
