当前位置: 移动技术网 > IT编程>开发语言>Asp > asp下实现UrlEncoding转换编码的代码

asp下实现UrlEncoding转换编码的代码

2017年12月12日  | 移动技术网IT编程  | 我要评论
'==================================================
'函数名: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

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网