zoukankan      html  css  js  c++  java
  • Javascript版 UrlEncode和UrlDecode函数

    在做项目的时候需要对(Internet) Search Engine导入链接进行Keyword analysis.

    Google  用的是js'encodeURI()函数,可直接用decodeURI()解码。
    Baidu 则用的是:
    System.Web.HttpUtility.UrlEncode("编码", System.Text.Encoding.GetEncoding("gb2312"))的编码,
    解码则需要用到:
    System.Web.HttpUtility.UrlDecode("%B1%E0%C2%EB", System.Text.Encoding.GetEncoding("GB2312")));
    这个需要用的ASP.NET C#.以下提供一个Javascript操作进行解码的方法.

    <script language="vbscript">
    Function str2asc(strstr) 
        str2asc 
    = hex(asc(strstr)) 
    End Function 

    Function asc2str(ascasc) 
        asc2str 
    = chr(ascasc) 
    End Function
    </script> 

    UrlEncode:

    UrlEncode


    UrlDecode:

    UrlDecode



     

  • 相关阅读:
    tp3.2和tp5的区别
    tp(调试模式,空操作,跨控制器调用,跨方法跳转--redirect(),框架语法,创建model模型)
    tp 连表查 分页 模糊查询
    thinkphp if和eq的区别
    js 面向对象例子
    JS字符串转换为JSON的四种方法笔记
    json在php中的使用之如何转换json为数组
    window.frames用法
    php js 数组排序
    控件常用
  • 原文地址:https://www.cnblogs.com/didi/p/1447616.html
Copyright © 2011-2022 走看看