I am trying to take the contents of a UITextField that may contain special characters and emojis and turn it into something I can pass in a GET request to a PHP service.
NSNonLossyASCIIStringEncoding
to stringByAddingPercentEscapesUsingEncoding:
returns nil
because the string you're passing in is not ASCII. Using NSUTF8StringEncoding
percent escapes the emoji characters and that's the result I would expect. If your server-side middleware is not automatically unescaping the emoji from the query string, then you should look to do that in your server-side code if it's causing issues upstream.