当前位置:首页 > 程序&理念 >

ASP URL解码

时间:2006-12-07 13:26:33浏览:36894 转载

<%
function URLDecode(enStr)
dim deStr,strSpecial
dim c,i,v
 deStr=""
 strSpecial="!""#$%&'()*+,.-_/:;<=>?@[]^`{|}~%"
 for i=1 to len(enStr)
 c=Mid(enStr,i,1)
 if c="%" then
 v=eval("&h"+Mid(enStr,i+1,2))
 if inStr(strSpecial,chr(v))>0 then
 deStr=deStr&chr(v)
 i=i+2
 else
 v=eval("&h"+ Mid(enStr,i+1,2) + Mid(enStr,i+4,2))
 deStr=deStr & chr(v)
 i=i+5
 end if
 else
 if c="+" then
 deStr=deStr&" "
 else
 deStr=deStr&c
 end if
 end if
 next
 URLDecode=deStr
end function

dim str
str = "http://file1.bbs.zcom.com%2F2%2F6%2F2%2F2%2F4%2F6%2F5%2F4%2F1143121202.mp3"
response.write URLDecode(str)
%>

上一篇:修改字段的类型 修改列名
下一篇:SQL Server各种日期计算方法

发表评论

昵称:  验证码:

关于博主

博主

博主:BlueCode

职业:web程序

简介:2002年开始一直从事Web制作,网站运营,会PHP+MYSQL ASP+MSSQL,微信开发