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:&quot;&lt;div&gt;content of inner html&lt;/div&gt;&quot;}, 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:

&quot;{&quot;user&quot;:{&quot;id&quot;:59,&quot;innerhtml&quot;:&quot;&lt;div&gt;content of inner html&lt;/div&gt;&quot;},&quot;data&quot;:[1,2,5]}&quot;

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的更多相关文章

  1. url的三个js编码函数escape(),encodeURI(),encodeURIComponent()简介

    url的三个js编码函数escape(),encodeURI(),encodeURIComponent()简介 2014年10月12日 16806次浏览 引子 浏览器URl地址,上网一定会用到,但是浏 ...

  2. escape,encodeURI,encodeURIComponent函数比较

    escape,encodeURI,encodeURIComponent函数比较 js对文字进行编码涉及3个函数:escape,encodeURI,encodeURIComponent,相应3个解码函数 ...

  3. escape,encodeURI,encodeURIComponent

    JavaScript/js中,有三个可以对字符串编码的函数,分别是: escape,encodeURI,encodeURIComponent,相应3个解码函数:unescape,decodeURI,d ...

  4. Flex中escape/encodeURI/encodeURIComponent的区别

    Flex中提供了三种转码函数,各有各的区别, escape,encodeURI,encodeURIComponent 这三个函数不仅在flex中有道运用在javascript中同样的含义 ,今天我仔细 ...

  5. url的三个js编码函数escape(),encodeURI(),encodeURIComponent()简介【转】

    引子 浏览器URl地址,上网一定会用到,但是浏览器地址有中文或者浏览器url参数操作的时候,经常会用到encodeURIComponent()和decodeURIComponent()以及encode ...

  6. JavaScript中有三个可以对字符串编码的函数,分别是: escape(),encodeURI(),encodeURIComponent()

    JavaScript中有三个可以对字符串编码的函数,分别是: escape,encodeURI,encodeURIComponent,相应3个解码函数:unescape,decodeURI,decod ...

  7. JavaScript中有对字符串编码的三个函数:escape,encodeURI,encodeURIComponent

    JavaScript中有三个可以对字符串编码的函数,分别是: escape,encodeURI,encodeURIComponent,相应3个解码函数:unescape,decodeURI,decod ...

  8. escape,encodeURI,encodeURIComponent的区别

    escape是对字符串进行编码而另外两种是对URL. encodeURI方法不会对下列字符编码 ASCII字母 数字 ~!@#$&*()=:/,;?+'encodeURIComponent方法 ...

  9. js中的三个编码函数:escape,encodeURI,encodeURIComponent

    1. eacape(): 该方法不会对 ASCII 字母和数字进行编码,也不会对下面这些 ASCII 标点符号进行编码: * @ - _ + . / .其他所有的字符都会被转义序列替换.其它情况下es ...

随机推荐

  1. FAQ of db2fmp messages in the db2diag.log

    http://www-01.ibm.com/support/docview.wss?uid=swg21470035 Technote (FAQ) Question What do these mess ...

  2. (转)总结之:CentOS 6.5 MySQL数据库的基础以及深入详解

    总结之:CentOS 6.5 MySQL数据库的基础以及深入详解 原文:http://tanxw.blog.51cto.com/4309543/1395539 前言 早期MySQL AB公司在2009 ...

  3. docker相关命令

    1. 进入docker容器 ① 查看运行的容器:docker ps -a ②  进入容器:docker exec -ti [容器id] bash ③ 退出容器:eixt

  4. Java反射机制的浅显理解(这篇文章还没写好,留个草稿给自己看的)

    目前只是有一个大概的理解,先把自己感觉容易立即的概念放这里,等以后结合实际工作理解深刻了再来补充. 一.什么是Java反射机制?(多种定义) 1. JAVA反射机制是在运行状态中,对于任意一个类,都能 ...

  5. JSTL之<c:set>的各种用法

    <c:set>标签用于设置变量值和对象属性 语法格式 <span style="font-size:18px;"><c:set var="& ...

  6. JavaScript数据结构-16.二叉树计数

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  7. 部署rails遇到问题

    underfined method for has_attched_file when installing paperclip 解决 create the file paperclip.rb ins ...

  8. wpf 自定义ListView

    1.listview.itemtemplate设置item的外层父元素的控件. 2.listview.template设置item的样式(datatemplate),也可以使用itemcontaine ...

  9. PHP代码实现强制换行

    1. 简单的,只能分2行: //$str:输入字符串: //$num:超过多少个字符后进行换行(换行后每行的最大字符数) function forceBlackString($str, $num){ ...

  10. *2.3.3-加入monitor

    验证平台必须监测DUT的行为,只有知道DUT的输入输出信号变化之后,才能根据这些信号变化来判定DUT的行为是否正确. 验证平台中实现监测DUT行为的组件是monitor.driver负责把transa ...