Balu Balu - 8 months ago 75
HTTP Question

Base64 Encoding difference in a particular String

I have a doubt. It's regarding Base64 encoding of one particular String.

We have an application which allows REST WebServices to be executed after authorization of type Basic Authentication is successful.

I has set the password for a user USER_NAME with the password [email protected].

From my system, using Postman/Advanced REST client, the request sent is processed successfully. But the same request fails when made most of the other systems using the same REST client.

When I set this password to another user, that user credentials is facing the same problem.

I noticed that the Base64 encoding Output Charset is the problem. But there is no method to change it in the REST clients (not in the most of the ready-made ones).

But why is this happening only for this particular password. I check with every other passwords and it works fine.

String: USER_NAME:[email protected]

UTF-8: VVNFUl9OQU1FOkNQQDVOMHYyMm5EMTdSclY4ZjTigIs=

Windows-1252: VVNFUl9OQU1FOkNQQDVOMHYyMm5EMTdSclY4ZjQ=

ASCII: VVNFUl9OQU1FOkNQQDVOMHYyMm5EMTdSclY4ZjQ=



Only for [email protected]​ the UTF-8 output charset encoding in Base64 is giving a different result.

Using any other passwords, all the outputs are the same.

Please make me understand why [email protected] is different from the rest of the strings.




Thanks in Advance

Balu

Answer Source

The string has a non breaking space at the end of the string.

I tested this using the following steps.

  1. Decoded the UTF-8 string VVNFUl9OQU1FOkNQQDVOMHYyMm5EMTdSclY4ZjTigIs= at https://www.base64decode.org/

  2. Copied the result to encode in UTF-8 at https://www.base64decode.org/, but this time pressed backspace once at the end of string. Gives me output VVNFUl9OQU1FOkNQQDVOMHYyMm5EMTdSclY4ZjQ=

You could also try typing the characters manually, and encoding.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download