NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Mark Sarson on May 30, 2011, 04:33:55 PM
-
Hi,
I'm testing the SagePay payment gateway. All is going quite well apart from a problem with the returned information from Sage.
They use Base64 encoding of a simple xor encryption, and this is a small snippet of what they return for a value called Crypt:
MQVW5mDy8cLwV3cWEqXHt3b0AUdx8+Yj08eFFoFF4K
However when I use MyVar = p_web.GetValue('Crypt'), MyVar contains
MQVW5mDy8cLwV3cWEqXHt3b0AUdx8 Yj08eFFoFF4K
Notice the + has been replaced by a space.
Now I have fixed my code up to replace the spaces GetValue returns with the + and I can decode without any problem.
So my question is, is this expected behavior or is there a bug?
Kinds regards
Mark
-
You don't specify where the value is coming from ( cookie, URL or post-data) but yes, this is expected, and probably correct behavior.
Data received into the value queue is URL-encoded, meaning that spaces are sent as a +, and every other non-alpha-numeric (including a +) is encoded using the %XX technique.
Cheers
Bruce
-
Hi Bruce
Thanks for the reply.
The data was coming from the URL.
I was just confused for a little while as my decode of the data was not returning the results as expected.
It was easy to solve when I worked out that I needed to replace the spaces back to pluses.
Cheers
Mark