加入收藏 | 设为首页 | 会员中心 | 我要投稿 银川站长网 (https://www.0951zz.com/)- 云通信、基础存储、云上网络、机器学习、视觉智能!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

ASP让url的中文显现成编码

发布时间:2023-06-29 13:30:22 所属栏目:Asp教程 来源:
导读:asp解码url:代码如下:<a href="1.asp?action=<%=server.urlencode("你好")%>">asdf</a>解码函数[code]<%Function URLDecode(enStr)dim deStr,strSpecialdim c,i,vdeStr=""strSpecial="!""#$%&&#39;()*+,.-_/:

asp解码url:

代码如下:

<a href="1.asp?action=<%=server.urlencode("你好")%>">asdf</a>

解码函数

[code]

<%

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

response.Write URLDecode(request.QueryString("action"))

%>

[html]

(编辑:银川站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章