Jump to content
ioan

TNetEncoding.URL.Decode question

Recommended Posts

I'm using TNetEncoding.URL.Encode to encode the following string:

E+C1NU0Z0ikcOdZF158VAypoEl4nc9bTokltVV+PkfPeO3/6pmZTRo3h17SC+x6SdK4qIrNnWv3rd9RGnQ==

 

The result is:

E%2BC1NU0Z0ikcOdZF158VAypoEl4nc9bTokltVV%2BPkfPeO3%2F6pmZTRo3h17SC%2Bx6SdK4qIrNnWv3rd9RGnQ%3D%3D

Trying to use TNetEncoding.URL.Decode doesn't get me back to the original string, what am I doing wrong? 

 

Share this post


Link to post

not sure..

 

procedure TMainFrm.Button1Click(Sender: TObject);
var
aStr,eStr,origStr:String;
begin

origStr:='E+C1NU0Z0ikcOdZF158VAypoEl4nc9bTokltVV+PkfPeO3/6pmZTRo3h17SC+x6SdK4qIrNnWv3rd9RGnQ==';
memDisplay.Lines.Insert(0,'Orig:'+origStr);
eStr:=tNetEncoding.URL.Encode(origStr);
memDisplay.Lines.Insert(0,'Encoded:'+eStr);
aStr:=tNetEncoding.URL.Decode(eStr);
memDisplay.Lines.Insert(0,'Decoded:'+aStr);
if aStr=origStr then
  memDisplay.Lines.Insert(0,'Equal')
    else
      memDisplay.Lines.Insert(0,'Differ');

end;

this seems to be equal..

netEncode.jpg

Share this post


Link to post

Yeah, I tried a simple application just to test and it does work, but in my service doesn't. 

7 minutes ago, qubits said:

not sure..

 

this seems to be equal..

 

Yes, I tried in a simple application and it does work. The problem is that in my service (IntraWeb service) doesn't:

 

 

Capture.JPG

Share this post


Link to post

looking at the pic, looks like LUserID was encoded not decoded, strange..

 

maybe try saving id into LUserID and Decode LUserID.

Edited by qubits

Share this post


Link to post

it's double encoded

 

"=" = "%3D"

"%3D" = "%253D"

 

 

 

Edited by Attila Kovacs
  • Like 2

Share this post


Link to post

lol, small little squiggles, only looked at LUserID, sorry.. 🙂

yeah, input is wrong, should match the encoded, no??

 

just one more decode and you got it..

or maybe hunt down extra encode..

Edited by qubits
  • Like 1

Share this post


Link to post
10 minutes ago, Attila Kovacs said:

it's double encoded

 

"=" = "%3D"

"%3D" = "%253D"

 

 

 

You right! That was it, thank you! I was losing my mind 🙂

 

image.thumb.png.78f5a979cd1ded99f2e4fc57d6940a23.png

 

 

Share this post


Link to post
4 hours ago, ioan said:

Yes, I tried in a simple application and it does work. The problem is that in my service (IntraWeb service) doesn't:

IntraWeb is built on top of Indy, and Indy has its own URL encoder/decoder (the TIdURI class).

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×