HTMLDecode Function:
Decodes an HTML encoded string.
Description:
The HTMLDecode function decodes an HTML encoded string back into the original html code. Use the GetWebPage function to grab some html use the server.htmlencode method to encode it and finally, decode the encoded HTML back into code. If it works, you see the generated html of the web page.
Syntax:
string = HTMLDecode(encodedstring)
Example:
<%
Response.Write HTMLDecode(Server.HTMLEncode(GetWebPage("http://www.lycos.com/")))
%>
ASP Source Code:
<%
Private Function HTMLDecode(byVal encodedstring) Dim tmp, i tmp = encodedstring tmp = Replace( tmp, """", chr(34) ) tmp = Replace( tmp, "<" , chr(60) ) tmp = Replace( tmp, ">" , chr(62) ) tmp = Replace( tmp, "&" , chr(38) ) tmp = Replace( tmp, " ", chr(32) ) For i = 1 to 255 tmp = Replace( tmp, "" & i & ";", chr( i ) ) Next HTMLDecode = tmp End Function
%>
|