Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URLEncode...then what? 2

Status
Not open for further replies.

apple17

Programmer
Jul 5, 2005
46
US
I have some text fields in my application that can contain apostrophes, etc. So I use URLEncode to get my data ready to store in my Access database. It goes in the database fine.

When it comes out and displays, how do I 'decode' it? There is no URLDecode in ASP apparently.

Thanks.
 
An example URLUnEncode function:
Code:
const Hexconvert = "0123456789ABCDEF"

function firsttwoHextoAscii(strHex)
dim dec
firsttwoHextoAscii = ""
if len(strHex)>1 then
dec = 16 * instr(1,Hexconvert,left(strHex,1),1) + _
instr(1,Hexconvert,mid(strHex,2,1),1) - 17
if dec>0 and dec<256 then
firsttwoHextoAscii = chr(dec)
end if
end if
end function

function URLunencode(strEncoded)
dim unencoded,part
if isnull(strEncoded) or strEncoded="" then
URLunencode = ""
else
unencoded = split(replace(strEncoded,"+"," "),"%")
for part = 1 to ubound(unencoded)
unencoded(part) = firsttwoHextoAscii(unencoded(part)) & _
mid(unencoded(part),3)
next
URLunencode = join(unencoded,"")
end if
end function

from here:



A smile is worth a thousand kind words. So smile, it's easy! :)
 
Argh...star for Chris for pointing me to a post that had a piece of functionality that I didn't know about...how did I never know about that GetRef function. I'd star Drexor but that post is archived and I'm not sure he is even active anymore...


barcode_1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top