zoukankan      html  css  js  c++  java
  • ASP和jq实现url传递参数乱码的escape编码和unescape解码

    <%

    Function vbsEscape(str)
        dim i,s,c,a
        s=""
        For i=1 to Len(str)
            c=Mid(str,i,1)
            a=ASCW(c)
            If (a>=48 and a<=57) or (a>=65 and a<=90) or (a>=97 and a<=122) Then
                s = s & c
            ElseIf InStr("@*_+-./",c)>0 Then
                s = s & c
            ElseIf a>0 and a<16 Then
                s = s & "%0" & Hex(a)
            ElseIf a>=16 and a<256 Then
                s = s & "%" & Hex(a)
            Else
                s = s & "%u" & Hex(a)
            End If
        Next
        vbsEscape = s
    End Function
     
    Function vbsUnEscape(str)
        dim i,s,c
        s=""
        For i=1 to Len(str)
            c=Mid(str,i,1)
            If Mid(str,i,2)="%u" and i<=Len(str)-5 Then
                If IsNumeric("&H" & Mid(str,i+2,4)) Then
                    s = s & CHRW(CInt("&H" & Mid(str,i+2,4)))
                    i = i+5
                Else
                    s = s & c
                End If
            ElseIf c="%" and i<=Len(str)-2 Then
                If IsNumeric("&H" & Mid(str,i+1,2)) Then
                    s = s & CHRW(CInt("&H" & Mid(str,i+1,2)))
                    i = i+2
                Else
                    s = s & c
                End If
            Else
                s = s & c
            End If
        Next
        vbsUnEscape = s
    End Function
    %>

  • 相关阅读:
    linux 常用命令(个人记录)
    jmeter 5.0版本更新说明(个人做个记录)
    Netdata---Linux系统性能实时监控平台部署记录
    MySQL Yum存储库 安装、升级、集群
    linux 各项配置汇总
    构建Maven项目自动下载jar包
    计算服务器的pv量算法
    性能计算公式
    jstack(查看线程)、jmap(查看内存)和jstat(性能分析)命令
    结构模式
  • 原文地址:https://www.cnblogs.com/ince/p/15080094.html
Copyright © 2011-2022 走看看