<%
function UrlDecode (Strin)
UrlDecode = ""
Dim Sl:sl = 1
Dim Tl:tl = 1
Dim Key:key = "%"
Dim Kl:kl = Len (key)
SL = InStr (SL, Strin, key, 1)
Do While sl>0
if (tl=1 and sl<>1) or TL<SL Then
UrlDecode = UrlDecode & Mid (Strin, TL, SL-TL)
End If
Dim hh, Hi, HL
Dim a
Select Case UCase (Mid (Strin, SL+KL, 1))
Case "U": ' Unicode UrlEncode
A = Mid (Strin, sl+kl+1, 4)
UrlDecode = UrlDecode & ChrW ("&h" & A)
SL = SL + 6
Case "E": ' Utf-8 UrlEncode
HH = Mid (Strin, SL+KL, 2)
a = Int ("&h" & hh) ' ASCII code
If ABS (a) <128 then
SL = SL + 3
UrlDecode = UrlDecode & Chr (a)
Else
Hi = Mid (Strin, SL+3+KL, 2)
HL = Mid (Strin, SL+6+KL, 2)
A = ("&h" & hh and &h0f) * 2 ^12 or ("&h" & Hi and &h3f) * 2 ^ 6 or ("&h" & HL and &h3 F
If a<0 then a = a + 65536
UrlDecode = UrlDecode & ChrW (a)
SL = SL + 9
End If
Case ELSE: ' ASC UrlEncode
HH = Mid (Strin, SL+KL, 2) ' High
a = Int ("&h" & hh) ' ASCII code
If ABS (a) <128 then
SL = SL + 3
Else
Hi = Mid (Strin, SL+3+KL, 2) ' Low
a = Int ("&h" & hh & Hi) ' Non-ASCII code
SL = SL + 6
End If
UrlDecode = UrlDecode & Chr (a)
End Select
TL = SL
SL = InStr (SL, Strin, key, 1)
Loop
UrlDecode = UrlDecode & Mid (Strin, TL)
End Function
%>
Below look at a site on the gb2312 and Utf-8 page Transfer parameter garbled Ultimate Solution
Ansi
<% @language = "VBScript" codepage= "936"%>
<%session.codepage=936%>
<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title>page (gb2312) -111cn.net</title>
<body>
<script type= "text/web Effects" >
document.write ("<a href= ' t2.asp tutorial? keyword=" + Escape ("wooden House") + "' > Miracle House </a>");
</script>
<br/>
<%
Response.Write (request.querystring ("keyword"))
%>
</body>
Uft-8
<% @language = "VBScript" codepage= "65001"%>
<%session.codepage=65001%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd ">
<meta http-equiv=" Content-type " Content= "text/html; Charset=utf-8 "/>
<title>page (utf-8) -111cn.net</title>
<body>
<script type= "Text/javascript" >
document.write ("<a href= ' t1.asp?keyword=" + Escape ("wooden House") + "' > Miracle House </a> ");
</script>
<br/>
<%
Response.Write (request.querystring ("keyword"))
%>
< /body>