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



     

  • 相关阅读:
    让原生select只读,即是有disabled的的感觉,但是却不实现disabled的功能
    log4j配置 简单jsp中调用查看报表配置 解析excel、txt为bean对象配置
    css背景渐变
    myeclipse始终build workspace
    spring实现重定向
    Mysql错误---
    POJ 1087 A Plug for UNIX 【最大流】
    POJ 3281 Dining 【最大流】【神建模】
    POJ 2135 Farm Tour 【模板】【最小费用最大流】
    LibreOJ 116 有源汇有上下界最大流 【模板】【上下界最大流】
  • 原文地址:https://www.cnblogs.com/didi/p/1447616.html
Copyright © 2011-2022 走看看