Click to See Complete Forum and Search --> : Decoding spaces


Bill Crawley
December 2nd, 2003, 09:02 AM
Hi All,

Within one of my query string value I could have a space that is interpreted as %20:

So if I enter the value "CM3 1AJ" the querystring value becomes:
"CM3%201AJ".

On the receiving page. if I simply do a response.write of the request.querystring value, or if I assign the Querystring value to a variable, then perform a response.write, the data looks ok, that is, I see displayed "CM3 1AJ".

I now assign the value to an inputbox to prepopulate:
<input maxlength=12 size=8 name=""Postcode"" value=" & Request.Form(strPostcode) & ">

and all that it is populated with is 'CM3'.

if I change it to be:

<input maxlength=12 size=8 name=""Postcode"" value=" & replace(Request.Form(strPostcode," ","ampersandnbsp;") & ">

I then get my value populating correctly.

If I then repost my screen, the screen appears ok, but I am told that my dispplayed data is in the incorrect format (a test against postcode that I have). I have tested the length and all looks ok. If I remove and re-enter the same postcode in the box, then my test passes. Somewhere during the repost I can only assume that there is an invalid character that is getting placed somewhere, but I dont know where. Running simple test's tells me that the length is 7 which is correct and that there is only 1 space in position 4 which is correct, so I dont see why it fails.
Thanks
Bill

Thread1
December 4th, 2003, 04:49 AM
<input maxlength=12 size=8 name=""Postcode"" value="<%=Request.Form(strPostcode)%>">

Or

<%Response.Write "<input maxlength=12 size=8 name=""Postcode"" value=""" & Request.Form(strPostcode) & """>"%>