473,406 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

urlencode(addslashes(chr(0)))

Any ideas as to why urlencode(addslashes(chr(0))) returns '%5C0'? It
seems like it should return '%00' since that's what urlencode(chr(0))
returns. If not that, I could also see it returning '%5C%00' since
that's what urlencode('\\').urlencode(chr(0)) and
urlencode('\\'.chr(0)) return. '%5C0', however, confuses me. Even
urlencode(chr(0x5C0)) doesn't return '%5C0' - it returns '%C0'.

Oct 23 '05 #1
1 3746
>Any ideas as to why urlencode(addslashes(chr(0))) returns '%5C0'? It

addslashes(chr(0)) should return '\0'.
seems like it should return '%00' since that's what urlencode(chr(0))
returns. If not that, I could also see it returning '%5C%00' since
that's what urlencode('\\').urlencode(chr(0)) and
urlencode('\\'.chr(0)) return. '%5C0', however, confuses me. Even
urlencode(chr(0x5C0)) doesn't return '%5C0' - it returns '%C0'.


urlencode '\0' and the backslash turns into %5C, and the 0 is unchanged.
Therefore, %5C0.

Gordon L. Burditt
Oct 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.