Con la sentencia URLEncode lo que se hace es codificar un String para que sea una cadena URL valida. Cuando se envia a otra página, esta ya lo decodifica automaticamente. Peró también se puede utilizar este String para hacer la descodificación en caso que lo necesitemos para algún caso especial.
<Script language=VBScript runat=server> Function URLDecode(strToDecode) strIn=strToDecode strOut="" intPos=Instr(strIn, "+") Do While intPos strLeft="" strRight="" If intPos > 1 then strLeft=Left(strIn, intPos - 1) If intPos < len(strIn) then strRight=Mid(strIn, intPos + 1) strIn=strLeft & " " & strRight intPos=InStr(InStr, "+") intLoop=intLoop + 1 Loop intPos=InStr(strIn, "%") Do while intPos If intPos > 1 then strOut = strOut & Left(strIn, intPos - 1) strOut = strOut & Chr(CInt("&H" & mid(strIn, intPos + 1, 2))) If intPos > (len(strIn) - 3) then strIn="" Else strIn=Mid(strIn, intPos + 3) End If intPos=InStr(strIn, "%") Loop URLDecode= strOut & strIn End Function </script>
|
|