Re: What does this do?
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 07:24:58 -0400
Trevor L. wrote:
> Roland,
> I am not sure that your answer gives the whole story
>
> You state:
You snipped some relevant context so I'm putting it back in:
>>> function encodestring(s)
>>>
>>> {
>>>
>>> return s.toString().replace(/\%/g, "%26").replace(/=/g, "%3D");
This seems to be a client-side replacement for the Server.URLEncode
function, which encodes strings to allow them to be used in the URL without
causing errors.
> Converts variable to string, replace all % to %26, replace all = to
> %3D.
> But you don't say what %26 is (I think it is &) or what %3D (I think
> it is =)
Almost correct. These are the codes that represent the strings
>
> Why is this done is an intersting question, e.g. why replace = by = ?
>
It;s not. It's replacing = with %3D
& and = have special meanings in a URL querystring. & delimits the
name/value pairs, and = separates the name of the variable from its value.
If you need to pass data that contains these characters via querystring,
then you need to encode the data so as not to confuse the program that
parses the querystring in te requested page.
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
.
- Follow-Ups:
- Re: What does this do?
- From: Roland Hall
- Re: What does this do?
- References:
- What does this do?
- From: Jeremy Chapman
- Re: What does this do?
- From: Roland Hall
- Re: What does this do?
- From: Trevor L.
- What does this do?
- Prev by Date: Re: What does this do?
- Next by Date: Re: IE6 onlick not firing
- Previous by thread: Re: What does this do?
- Next by thread: Re: What does this do?
- Index(es):
Relevant Pages
|