So I am making a POST call to my server with the following code:
NSCharacterSet *set = [NSCharacterSet URLQueryAllowedCharacterSet];
NSString *POSTencoded = [POSTdata stringByAddingPercentEncodingWithAllowedCharacters:set];
NSData *postData = [POSTencoded dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
[request setHTTPBody:postData];
The function stringByAddingPercentEncodingWithAllowedCharacters: automatically uses UTF-8 encoding on my string, according to Apple's documentation. I am not sure if it's a lossy conversion or not though.
Then on the next line I encode the data again, making sure I set allowLossyConversion: to YES.
Questions:
Does
stringByAddingPercentEncodingWithAllowedCharacters:have lossy conversion set toYESorNO?Does double-encoding with UTF8 have the potential to convert some of my characters in unforeseen ways?