escape,encodeURI,encodeURIComponent, URLEncode, RawURLEncode, HTMLEntity, AddSlash, JSON Encode
online tooling: http://www.the-art-of-web.com/javascript/escape/
input : {user:{id:59,innerhtml:"<div>content of inner html</div>"}, data: [1,2,5]}
1. JSON ENCODE: "{user:{id:59,innerhtml:\"<div>content of inner html<\/div>\"}, data: [1,2,5]}"
2. escape:
%7Buser%3A%7Bid%3A59%2Cinnerhtml%3A%22%3Cdiv%3Econtent%20of%20inner%20html%3C/div%3E%22%7D%2C%20data%3A%20%5B1%2C2%2C5%5D%7D
3. encodeURI:
%7Buser:%7Bid:59,innerhtml:%22%3Cdiv%3Econtent%20of%20inner%20html%3C/div%3E%22%7D,%20data:%20%5B1,2,5%5D%7D
4. EncodeURIComponent:
%7Buser%3A%7Bid%3A59%2Cinnerhtml%3A%22%3Cdiv%3Econtent%20of%20inner%20html%3C%2Fdiv%3E%22%7D%2C%20data%3A%20%5B1%2C2%2C5%5D%7D
5. URL Encode: PHP function:urlencode
%7Buser%3A%7Bid%3A59%2Cinnerhtml%3A%22%3Cdiv%3Econtent+of+inner+html%3C%2Fdiv%3E%22%7D%2C+data%3A+%5B1%2C2%2C5%5D%7D
6. Raw URL Encode: PHP function:rawurlencode
%7Buser%3A%7Bid%3A59%2Cinnerhtml%3A%22%3Cdiv%3Econtent%20of%20inner%20html%3C%2Fdiv%3E%22%7D%2C%20data%3A%20%5B1%2C2%2C5%5D%7D
7. HTML Entities: PHP function:htmlentities
{user:{id:59,innerhtml:"<div>content of inner html</div>"}, data: [1,2,5]}
8. Add Slashes: PHP function:addslashes
{user:{id:59,innerhtml:\"<div>content of inner html</div>\"}, data: [1,2,5]}
9. UTF8 Encode: PHP function:utf8_encode
{user:{id:59,innerhtml:"<div>content of inner html</div>"}, data: [1,2,5]}
10. JSON.stringify()
"{"user":{"id":59,"innerhtml":"<div>content of inner html</div>"},"data":[1,2,5]}"
input: "{"user":{"id":59,"innerhtml":"<div>content of inner html</div>"},"data":[1,2,5]}"
escape:
%22%7B%22user%22%3A%7B%22id%22%3A59%2C%22innerhtml%22%3A%22%3Cdiv%3Econtent%20of%20inner%20html%3C/div%3E%22%7D%2C%22data%22%3A%5B1%2C2%2C5%5D%7D%22
encodeURI:
%22%7B%22user%22:%7B%22id%22:59,%22innerhtml%22:%22%3Cdiv%3Econtent%20of%20inner%20html%3C/div%3E%22%7D,%22data%22:%5B1,2,5%5D%7D%22
encodeURIComponent:
%22%7B%22user%22%3A%7B%22id%22%3A59%2C%22innerhtml%22%3A%22%3Cdiv%3Econtent%20of%20inner%20html%3C%2Fdiv%3E%22%7D%2C%22data%22%3A%5B1%2C2%2C5%5D%7D%22
URLEncode:
%22%7B%22user%22%3A%7B%22id%22%3A59%2C%22innerhtml%22%3A%22%3Cdiv%3Econtent+of+inner+html%3C%2Fdiv%3E%22%7D%2C%22data%22%3A%5B1%2C2%2C5%5D%7D%22
Raw URL Encode:
%22%7B%22user%22%3A%7B%22id%22%3A59%2C%22innerhtml%22%3A%22%3Cdiv%3Econtent%20of%20inner%20html%3C%2Fdiv%3E%22%7D%2C%22data%22%3A%5B1%2C2%2C5%5D%7D%22
HTML Entities:
"{"user":{"id":59,"innerhtml":"<div>content of inner html</div>"},"data":[1,2,5]}"
AddSlashes:
\"{\"user\":{\"id\":59,\"innerhtml\":\"<div>content of inner html</div>\"},\"data\":[1,2,5]}\"
JSON Encode:
"\"{\"user\":{\"id\":59,\"innerhtml\":\"<div>content of inner html<\/div>\"},\"data\":[1,2,5]}\""
escape,encodeURI,encodeURIComponent, URLEncode, RawURLEncode, HTMLEntity, AddSlash, JSON Encode的更多相关文章
- url的三个js编码函数escape(),encodeURI(),encodeURIComponent()简介
url的三个js编码函数escape(),encodeURI(),encodeURIComponent()简介 2014年10月12日 16806次浏览 引子 浏览器URl地址,上网一定会用到,但是浏 ...
- escape,encodeURI,encodeURIComponent函数比较
escape,encodeURI,encodeURIComponent函数比较 js对文字进行编码涉及3个函数:escape,encodeURI,encodeURIComponent,相应3个解码函数 ...
- escape,encodeURI,encodeURIComponent
JavaScript/js中,有三个可以对字符串编码的函数,分别是: escape,encodeURI,encodeURIComponent,相应3个解码函数:unescape,decodeURI,d ...
- Flex中escape/encodeURI/encodeURIComponent的区别
Flex中提供了三种转码函数,各有各的区别, escape,encodeURI,encodeURIComponent 这三个函数不仅在flex中有道运用在javascript中同样的含义 ,今天我仔细 ...
- url的三个js编码函数escape(),encodeURI(),encodeURIComponent()简介【转】
引子 浏览器URl地址,上网一定会用到,但是浏览器地址有中文或者浏览器url参数操作的时候,经常会用到encodeURIComponent()和decodeURIComponent()以及encode ...
- JavaScript中有三个可以对字符串编码的函数,分别是: escape(),encodeURI(),encodeURIComponent()
JavaScript中有三个可以对字符串编码的函数,分别是: escape,encodeURI,encodeURIComponent,相应3个解码函数:unescape,decodeURI,decod ...
- JavaScript中有对字符串编码的三个函数:escape,encodeURI,encodeURIComponent
JavaScript中有三个可以对字符串编码的函数,分别是: escape,encodeURI,encodeURIComponent,相应3个解码函数:unescape,decodeURI,decod ...
- escape,encodeURI,encodeURIComponent的区别
escape是对字符串进行编码而另外两种是对URL. encodeURI方法不会对下列字符编码 ASCII字母 数字 ~!@#$&*()=:/,;?+'encodeURIComponent方法 ...
- js中的三个编码函数:escape,encodeURI,encodeURIComponent
1. eacape(): 该方法不会对 ASCII 字母和数字进行编码,也不会对下面这些 ASCII 标点符号进行编码: * @ - _ + . / .其他所有的字符都会被转义序列替换.其它情况下es ...
随机推荐
- Mac 10.12安装飞鸽传书IPMessager
说明:这个版本的飞鸽传书不能和Linux的互通,但是可以和Windows的互通,我猜测是协议问题:如果想要互通只能是Mac和Linux同时安装iptux. 下载: (链接: https://pan.b ...
- springboot项目:登录 登录aop拦截 使用Redis与cookie 进行设置获取清除操作
登录.登出: 第一步:在pom文件中引入依赖 <dependency> <groupId>org.springframework.boot</groupId> &l ...
- WebDriver+TestNG的一个典型例子
想让测试更加灵活,1. 可以配置使用任意支持的浏览器进行测试:2. 配置所有Google的URL:3. 配置搜索的关键字.修改后的代码: public class GoogleTest { WebDr ...
- Types的Type访问模式
在Types类中定义的访问都类如下: 1.MapVisitor类 2.SimpleVisitor 3.UnaryVisitor 4.TypeRelation
- java7之Special Methods
1.关于<init>与<clinit> At the level of the Java Virtual Machine, every constructor written ...
- linux下的ps命令
ps命令用于报告当前系统的进程状态.可以搭配kill指令随时中断.删除不必要的程序.ps命令是最基本同时也是非常强大的进程查看命令,使用该命令可以确定有哪些进程正在运行和运行的状态.进程是否结束.进程 ...
- 解决Ubuntu 18.04中文输入法的问题
https://ywnz.com/linuxjc/1637.html
- CentOS 6.4下安装JIRA6.3.6破解汉化
JIRA产品非常完善且功能强大,安装配置简单,多语言支持.界面十分友好,和其他系统如CVS.Subversion(SVN).VSS.LDAP.邮件服务整合得相当好,文档齐全,可用性以及可扩展性方面都十 ...
- [心平气和读经典]The TCP/IP Guide(002)
The TCP/IP Guide [Page 41, 42] Goals of The TCP/IP Guide | 本书的目标 Every author who sets out to write ...
- MkDocs
Overview MkDocs is a fast, simple and downright gorgeous static site generator that's geared towards ...