Balu Balu - 3 years ago 220
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 CP@5N0v22nD17RrV8f4​.

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:CP@5N0v22nD17RrV8f4​




Only for CP@5N0v22nD17RrV8f4​ 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 CP@5N0v22nD17RrV8f4​ is different from the rest of the strings.

Thanks in Advance


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

  2. Copied the result to encode in UTF-8 at, 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