支持中文转换的Asp UrlDecode函数
分类:程序开发 Tags: asp UrlDecode 评论:0 浏览:3649 最近更新时间: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输出26个英文字母的方法代码
• ASP几种常见分页代码
• 1小时ASP入门,教你简单学会ASP
• asp执行出错,直接忽略错误代码
• asp导出excel文件方法
• 一个表单中如何实现多个按钮提交的方法代码
• 通用ASP生成HTML代码,无需读取模版
• 兼容ie,火狐,chrome,safari,360,qq,遨游,搜狗等浏览器的设为首页和加入收藏代码
• 利用ASP显示当前网站在线人数代码
• fckeditor报错FCKLang undefined(fcklang未定义)的解决方法