Click here to Skip to main content
11,924,573 members (57,972 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++ C Javascript MFC encoding , +
There are some groups of data:

before encode: djVjM3R5emFu
after encode: RDJNNEU4MjAyMjI3MjkzMjM0





Please help me. It's very important to me. Thanks!!
Posted 1-Dec-12 8:10am
Edited 1-Dec-12 20:53pm
Nelek 1-Dec-12 13:45pm
Please don't think we can read minds or do astral projections to see your monitor. If you need help, the least you could do is to add some relevant code to your question or to explain your problem in such a way, that the users of CP can understand it. Otherwise, nobody will be able to help you.
How to ask a question?[^]
Joneeky 2-Dec-12 2:28am
Sorry! For an eg.. A function called "Encode", It declared like "void Endcode(CString& str)".Then I call it by...
CStirng str = _T("djVjM3R5emFu");
The result of str is "RDJNNEU4MjAyMjI3MjkzMjM0".
I just want know how I can write the "Encode" function.
I think coders can understand my meaning.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

When you use the encode and decode commands/functions/methods

you are only expected to encode/decode the values.
So if you have something like....
RedirectUrl = ("PlaceOrder.aspx?ProductName=Toolbox complete with free Spanners")
You can break that down into the following portions.......

PAGE KEY VALUE... Where...
PAGE is "PlaceOrder.aspx"
KEY is "ProductName" (no spaces!)
VALUE is "Toolbox complete with free Spanners"

Then you would ONLY encode/decode the VALUE(s)
So you would end up with something like....
RedirectUrl = ("PlaceOrder.aspx?ProductName=" & httpEncode("Toolbox complete with free Spanners"))

And as we used ENCODE to encode the VALUE, on the other side (where the data is recieved) we would use DECODE to decode the VALUE only.

Keep in mind that you can have MULTIPLE key/value pairs but ONLY one page
Joneeky 2-Dec-12 1:52am
Thank you for your answer.I'm understand your meaning.But I just want to know how to encode for it. Such as "djVjM3R5emFu" to "RDJNNEU4MjAyMjI3MjkzMjM0", must have a process to do it. Now, I want to find out the process.
Zaf Khan 2-Dec-12 9:51am
Take a look at the MSDN documentation for the HTTPUtility.HtmlEncode Method which van be found on or by clicking here
Joneeky 2-Dec-12 9:58am
I can not open this link, it displays "Unable to Service Request". Can you copy it and paste on here?
Zaf Khan 3-Dec-12 5:18am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Take a look at these samples[^].

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151125.3 | Last Updated 2 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100