支持中文转换的Asp UrlDecode函数
分类:程序开发 Tags: asp UrlDecode 评论:0 浏览:4095 最近更新时间:2014/8/23 13:10:58
<%
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码
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 &H3F)
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)'高位
a = Int("&H" & hh)'ascii码
If Abs(a)<128 Then
sl = sl + 3
Else
hi = Mid(strIn, sl+3+kl, 2)'低位
a = Int("&H" & hh & hi)'非ascii码
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
%>本文地址:/531/
-
• asp执行出错,直接忽略错误代码
• ASP判断手机号码输入是否正确正则代码
• ASP连接Access数据库绝对路径代码
• ASP在后一页刷新前一页代码
• asp导出excel文件方法
• ASP网页过滤HTML代码的多种方法
• 一个表单中如何实现多个按钮提交的方法代码
• 通用ASP生成HTML代码,无需读取模版
• asp检测email地址是否有效函数
• 把Access 2010 .accdb文件格式转换为Access 2003 .mdb操作方法
-
• FCKEditor2.5编辑器设置及修改方法For ASP,支持UTF-8编码
• 263企业邮箱配置foxmail收发信教程
• 如何免费点亮、关闭熄灭QQTalk团队语音图标?
• 安装浏览器插件Fatkun,实现下载任意网页上的图片视频
• 解决ZOHO企业邮箱发信提示服务器不支持ssl,发信失败问题
• 11.11光棍节搞笑短信+光棍节搞笑QQ表情+光棍节的由来
• 国外提供域名免费DNS解析服务商收集
• 如何制作英语名片?English Name Card Design
• Dreamweaver 正则表达式字符查找替换方法
• 教你如何挑选电脑椅!选购电脑椅尽量选择有可调节功能的!