您现在的位置: 设计龙 >> 网络编程 >> asp教程 >> 正文

asp 编码转换之 url编码转换器函数分享

Author:未知 Link:本站原创 Hits: Update:2008-3-29 22:27:19
天极网摘 ViVi收藏夹 365Key 和讯网摘 POCO网摘
ASP中把中文和一些符号转换为URL编码直接有一个函数直接转,但是却没有反编码的函数,这样很多人都比较麻烦。在网站找了很长时间才找到了以下的一个函数,效果不错,贴上来提供有需要的朋友分享。
 
asp 编码转换之 url编码转换器函数如下:
Function URLDecode(enStr)
  dim deStr,strSpecial
  dim c,i,v
    deStr=""
    strSpecial="!""#$%&'()*+,.-_/:;<=>?@[\]^`{|}~%"
    for i=1 to len(enStr)
      c=Mid(enStr,i,1)
      if c="%" then
        v=eval("&h"+Mid(enStr,i+1,2))
        if inStr(strSpecial,chr(v))>0 then
          deStr=deStr&chr(v)
          i=i+2
        else
          v=eval("&h"+ Mid(enStr,i+1,2) + Mid(enStr,i+4,2))
          deStr=deStr & chr(v)
          i=i+5
        end if
      else
        if c="+" then
          deStr=deStr&" "
        else
          deStr=deStr&c
        end if
      end if
    next
    URLDecode=deStr
End function
   
  • 上一篇文章:
  • 下一篇文章: 没有了
  • [回到标题] [回到顶部]
       相关文章
    没有相关文章