URL编码和解码工具
开发中发现需要进行URL的编解码,每次百度出来的还带广告而且比较慢,写了一个本地的工具,比较简单,希望对大家有帮助。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Author: Kang, Leo
Date: 2015-8-19
Email: kangyi@staff.weibo.com
QQ: 531155260
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
textarea{
height:200px;
width:100%;
margin:5px;
} input{
height:40px;
width:100%;
margin:5px;
background:#00CED1} .button2{
height:40px;
width:100%;
margin:5px;
background:#00FF7F} </style>
</head>
<body>
<script type="text/javascript">
function funDecode(){
var url = document.getElementById("url_input").value; document.getElementById("url_decoded_input").value = decodeURIComponent(url.replace(/\+/g, " "));
} function funEncode(){
var url = document.getElementById("url_decoded_input").value; document.getElementById("url_encode_input").value = encodeURIComponent(url).replace(/'/g,"%27").replace(/"/g,"%22");
}
</script>
<form name="myForm">
<h4>需要解码的URL:</h4>
<textarea id="url_input" name="input" rows="14" maxlength="32768"></textarea>
<br />
<input type="button" name="urlDecodeInput" value="点击开始URL解码" onclick="funDecode()" />
<br />
<h4>解码后的URL或者待编码的URL:</h4>
<textarea id="url_decoded_input" name="input" rows="14" maxlength="32768"></textarea>
</form>
<form name="myForm">
<input type="button" name="urlEncodeButton" class="button2" value="点击开始URL编码" onclick="funEncode()" />
<br />
<h4>编码后的URL:</h4>
<textarea id="url_encode_input" name="input" rows="14" maxlength="32768"></textarea>
</form>
</body>
</html>
URL编码和解码工具的更多相关文章
- Web开发须知:URL编码与解码
通常如果一样东西需要编码,说明这样东西并不适合传输.原因多种多样,如Size过大,包含隐私数据,对于Url来说,之所以要进行编码,是因为Url中有些字符会引起歧义. 例如,Url参数字符串中使用key ...
- java中的url 编码与解码
什么是application/x-www-form-urlencoded字符串? 答:它是一种编码类型.当URL地址里包含非西欧字符的字符串时,系统会将这些字符转换成application/x-www ...
- python接口自动化测试十三:url编码与解码
# url编码与解码 from urllib import parse url = 'http://zzk.cnblogs.com/s/blogpost?Keywords=中文' a = '中文' b ...
- LR URL编码和解码方法
问题:URL=http://www.baidu.com/s?wd=%E6%B5%B7%E6%B7%80%E9%BB%84%E5%BA%84"中要对%E6%B5%B7%E6%B7%80%E9% ...
- Oracle url编码与解码
Oracle url编码与解码 CreateTime--2018年3月30日17:26:36 Author:Marydon 一.url编码 实现方式:utl_url.escape() 说明:utl ...
- python中的URL编码和解码
python中的URL编码和解码:test.py # 引入urllib的request模块 import urllib.request url = 'https://www.douban.com/j/ ...
- Delphi编码与签名【URL编码与解码,Base64编码与解码,MD5加密,HMAC-SHA1、HMAC-SHA224、HMAC-SHA256、HMAC-SHA384和HMAC-SHA512签名】
作者QQ:(648437169) 点击下载➨delphi编码与签名 [Delphi编码与签名]URL编码与解码,Base64编码与解码,MD5加密,HMAC-SHA1.HMAC-SHA224.HMAC ...
- Javascript中的url编码与解码(详解)
摘要 本文主要针对URI编解码的相关问题做了介绍,对url编码中哪些字符需要编码.为什么需要编码做了详细的说明,并对比分析了Javascript中和编解码相关的几对函数escape / unescap ...
- Web开发:URL编码与解码(转)
原文:http://www.cnblogs.com/greatverve/archive/2011/12/12/URL-Encoding-Decoding.html 通常如果一样东西需要编码,说明这样 ...
随机推荐
- 【转】mybatis实战教程(mybatis in action),mybatis入门到精通
MyBatis 目录(?)[-] mybatis实战教程mybatis in action之一开发环境搭建 mybatis实战教程mybatis in action之二以接口的方式编程 mybatis ...
- 字符串反转----将this is good 转化为good is this 输出。
思路:现将整个字符串反转,再将每个单词反转: #include "iostream" #include "cstring" using namespace st ...
- 三分之一的程序猿之社交类app踩过的那些坑
三分之一的程序猿之社交类app踩过的那些坑 万众创新,全民创业.哪怕去年陌生人社交不管融资与否都倒闭了不知道多少家,但是依然有很多陌生人社交应用层出不穷的冒出来.各种脑洞大开,让人拍案叫起. 下面我们 ...
- 我认识的log4j开源日志
Log4j 在java中如何配置log4j!! 步骤: ①引入jar包,推荐新建一个lib文件夹,用来装所有的jar包(还要进行下图内的操作) 之后项目中就会多出一个引入外部Library的项目 ②创 ...
- Spring实现IOC
目录 一.使用XML配置的方式实现IOC 二.使用Spring注解配置IOC 三.自动装配 四.零配置实现IOC 五.示例下载 控制反转IoC(Inversion of Control),是一种设计思 ...
- C语言中关于POW在不同状态下四舍五入的解决方法
这是今天作业中的一个代码: #include <stdio.h>#include<math.h>int main(){ printf("请输入一个整数:") ...
- Logstash学习-plugin安装
Usage: bin/logstash-plugin [OPTIONS] SUBCOMMAND [ARG] ... Parameters: SUBCOMMAND subcommand [ARG] .. ...
- libevent源码分析:event_assign、event_new
在libevent中,获取event类型对象的方法有两种,event_assign.event_new 1.event_assign() /** Prepare a new, already-allo ...
- python中的 descriptor
学好和用好python, descriptor是必须跨越过去的一个点,现在虽然Python书籍花样百出,但是似乎都是在介绍一些Python库而已,对Python语言本身的关注很少,或者即使关注了,但是 ...
- angular源码阅读,依赖注入的原理:injector,provider,module之间的关系。
最开始使用angular的时候,总是觉得它的依赖注入方式非常神奇. 如果你跳槽的时候对新公司说,我曾经使用过angular,那他们肯定会问你angular的依赖注入原理是什么? 这篇博客其实是angu ...