用户登录
用户注册

分享至

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

  • 作者: 丿画忆
  • 来源: 51数据库
  • 2021-07-11
'==================================================
'函数名: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
软件
前端设计
程序设计
Java相关