0

I am passing Base64 encoded String to API call, but when we receive in API it shows as space .

Eg.) Passing like this "kv+lluLOKRkGK6v+BqNPAPsx" But in API response receive "kv lluLOKRkGK6v BqNPAPsx" like this.

Can anyone explain why swift not sending "+" symbol in API. And Please tell how to solve this.

  • It sounds like your base64-encoded data is being decoded as if it were [x-www-form-urlencoded](https://en.wikipedia.org/wiki/Percent-encoding#The_application/x-www-form-urlencoded_type), which (among other things) decodes `+` to space. But you need to post some code and describe the API in more detail if you want more help. – rob mayoff Sep 03 '22 at 07:09

1 Answers1

0

Use the proper Base64 variant that does not have the + character for REST calls: RFC 4648 base64url.

If you can't change the encoding, simply transcode the Base64 you receive.

meaning-matters
  • 21,929
  • 10
  • 82
  • 142