encodeURIComponent用法UrlEncode与URLEncode.encode()
时间:2009-05-11 12:40:00
<script>
alert(escape("人"));
alert(encodeURI("人"));
alert(encodeURIComponent("人"));
alert(UrlEncode("人"));
function UrlEncode(str){
var i,temp,p,q;
var result="";
for(i=0;itemp = str.charCodeAt(i);
if(temp>=0x4e00){
execScript("ascCode=hex(asc(\""+str.charAt(i)+"\"))", "vbscript");
result+=ascCode.replace(/(.{2})/g, "%$1");
}else{
result+=escape(str.charAt(i));
}
}
return result;
}
</script>
vnet:%c8%cb
在JS中,可用上定义的UrlEncode
escape:%u4EBA
encodeURI 和 encodeURIComponent:%E4%BA%BA
标签:UrlEncode,encode,url,转换
0
投稿
猜你喜欢
Python调整matplotlib图片大小的3种方法汇总
2023-11-28 13:20:26
php实现XSS安全过滤的方法
2024-05-05 09:16:15
Python unittest生成测试报告过程解析
2023-02-18 13:13:17
python五子棋游戏的设计与实现
2021-04-19 07:17:43
SpringCloud Config连接git与数据库流程分析讲解
2024-01-14 01:29:29
asp如何正确理解MIME类型?
2010-06-28 18:21:00
Python语言生成水仙花数代码示例
2022-11-16 18:17:48
PowerDesigner中如何导入SQL Server数据库
2024-01-17 08:38:46
Python实现的列表排序、反转操作示例
2023-06-19 11:14:27
Django rest framework如何自定义用户表
2022-03-12 01:15:02
Go标准库日志打印及同时输出到控制台与文件
2024-04-26 17:22:40
Python使用正则表达式分割字符串的实现方法
2023-03-12 07:13:49
4个的Python自动化脚本分享
2021-05-28 19:22:29
Python编写合并字典并实现敏感目录的小脚本
2023-05-28 18:36:29
jquery模拟SELECT下拉框取值效果
2024-04-22 12:58:56
python输出国际象棋棋盘的实例分享
2023-10-31 08:49:49
SQL Server数据库涉及到的数据仓库概念
2009-01-15 12:58:00
使用python检查yaml配置文件是否符合要求
2021-06-23 05:27:53
vue项目中使用this.$confirm解析
2024-05-02 17:02:09
关于matplotlib及相关cmap参数的取值方式
2023-06-26 15:19:18