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 通常如果一样东西需要编码,说明这样 ...
随机推荐
- sql server 数据库 日期格式转换
日期时间转字符串:Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM Select CONVERT(varchar(100), ...
- HDU-1274 展开字符串
Problem Description 在纺织CAD系统开发过程中,经常会遇到纱线排列的问题.该问题的描述是这样的:常用纱线的品种一般不会超过25种,所以分别可以用小写字母表示不同的纱线,例如:abc ...
- PHP+ExtJS 文件上传示例
xtJS 4 有一个非常方便的文件上传组件,可以用来将文件上传到服务器.本文PHP教程UncleToo将介绍使用PHP和ExtJS实现文件上传功能. 首先,创建文件上传组件Ext.form.Panel ...
- SWFUpload
引用:http://www.cnblogs.com/2050/archive/2012/08/29/2662932.html SWFUpload是一个flash和js相结合而成的文件上传插件,其功能非 ...
- IUS database
仿真中的database主要存放关于signal transition以及时间点的信息. IUS中的的database包括: 1) SHM, Verilog/VHDL/mixed-language的d ...
- 【转】CentOS系统中常用查看日志命令
来源:http://www.centoscn.com/CentOS/help/2014/0310/2540.html Linux IDE RedHat 防火墙活动 .cat tail -f 日 志 文 ...
- s5pv210编译qt
undefined reference to `rpl_malloc' 编译tslib,执行make时提示undefined reference to `rpl_malloc' 是因为config.h ...
- C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0
C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0
- Css、javascript、dom(二)
一.css常用标签及页面布局 1.常用标签 position(定位) z-index(定位多层顺序) background(背景) margin(外边距) padding(内边距) font-size ...
- spring " expected single matching bean but found 2" 问题一例。
初入java,使用spring时遇到一个问题,左边是一个接口和实现.右边是service和实现. @Service@Transactional(rollbackFor = Exception.clas ...