In my app, I need to send to a server a base64-encoded string as a query parameter, eg.
&data=AwGZnyx+JUi0PFJoyYSEDpgtlrxP(cut...)==
Problem is, anything works just fine when there isn't a plus sign in my string: on the other hand, everytime there's one, the server code doesn't behave correctly.
I noticed there are escaping functions (eg. addingPercentEncoding
) but they don't work with the plus sign.
Aside from removing all the pluses "manually" (eg. with a regex), is there anything else I can do?
At the moment anything works fine if I use:
string.replacingOccurrences(of: "+", with: "%2B")