URL Decode HTML encoded in JavaScript

B

Ben Amada

Hello. I have some HTML that I would like to pass to a popup webform via a
querystring. I've run into some problems which I believe is because I need
to encode the HTML. The popup webform is being created via JavaScript so I
need to use JavaScript to encode the HTML. The problem is that I'm not sure
if the URLDecode function in .NET is fully compatible with the encoding
function in JavaScript.

I found the following two JavaScript encoding functions:

escape(param)
encodeURI(param)

I'm leaning towards using encodeURI as it is a newer, and probably more
reliable function. Has anyone used the encodeURI function before with
..NET's URLDecode function? Do they work well with each other??

TIA,
Ben
 
B

Ben Amada

Ben said:
escape(param)
encodeURI(param)

I'm leaning towards using encodeURI as it is a newer, and probably more
reliable function.

After some more testing, it seems as though the 'escape' function works
better. Specifically with a # sign, encodeURI doesn't encode it at all
which is giving me problems. 'escape', on the other hand, properly encodes
the # to %23.

So I guess my question now is, is .NET's URLDecode function fully compatible
with JavaScript's 'escape' function? Is anyone else using anything else
besides 'escape' that they've found works better?

Thanks once again,
Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top