asp下实现UrlEncoding转换编码的代码
程序员文章站
2022-05-03 13:06:14
'================================================== '函数名:urlencoding '作 用:转...
'==================================================
'函数名:urlencoding
'作 用:转换编码
'==================================================
function urlencoding(datastr)
dim strreturn,si,thischr,innercode,hight8,low8
strreturn = ""
for si = 1 to len(datastr)
thischr = mid(datastr,si,1)
if abs(asc(thischr)) < &hff then
strreturn = strreturn & thischr
else
innercode = asc(thischr)
if innercode < 0 then
innercode = innercode + &h10000
end if
hight8 = (innercode and &hff00)\ &hff
low8 = innercode and &hff
strreturn = strreturn & "%" & hex(hight8) & "%" & hex(low8)
end if
next
urlencoding = strreturn
end function
'函数名:urlencoding
'作 用:转换编码
'==================================================
function urlencoding(datastr)
dim strreturn,si,thischr,innercode,hight8,low8
strreturn = ""
for si = 1 to len(datastr)
thischr = mid(datastr,si,1)
if abs(asc(thischr)) < &hff then
strreturn = strreturn & thischr
else
innercode = asc(thischr)
if innercode < 0 then
innercode = innercode + &h10000
end if
hight8 = (innercode and &hff00)\ &hff
low8 = innercode and &hff
strreturn = strreturn & "%" & hex(hight8) & "%" & hex(low8)
end if
next
urlencoding = strreturn
end function
上一篇: C#中获取指定目录下所有目录的名称、全路径和创建日期
下一篇: 索引失效-B