function UrlEncode(str)//url编码
{
var i,temp,p,q;
var result="";
for(i=0;i<str.length;i++)
{  
temp = 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;
}

function UrlDecode( str )
{
var i,temp;
var result = "";

for( i=0; i<str.length; i++ )
{
if( str.charAt(i) == "%" )
{   
   if( str.charAt(++i) == "u" )
   {    
    temp = str.charAt(i++) + str.charAt(i++) + str.charAt(i++) + str.charAt(i++) + str.charAt(i);
    result += unescape("%" + temp);
   }
   else
   {
    temp = str.charAt(i++) + str.charAt(i);
    if( eval("0x"+temp) <= 160 )
    {    
     result += unescape( "%" + temp );
    }
    else
    {
     temp += str.charAt(++i) + str.charAt(++i) + str.charAt(++i);
     result += Decode_unit("%" + temp);   
    }   
   }  
}
else
{
   result += str.charAt(i);
}
}

return result;
}

最新文章

  1. 程序员必须要知道的Hadoop的一些事实
  2. SQL Server 2014新特性探秘(2)-SSD Buffer Pool Extension
  3. Windows 双网卡指定网络出口
  4. ArcGIS Engine中数据的加载 (转)
  5. HashSet、LinkedHashSet、TreeSet
  6. Tools Function
  7. Visual studio 2013安装及单元测试
  8. MySQL定时检查是否宕机并邮件通知
  9. 稀疏表示(sparse representation)和字典学习
  10. Xposed知识
  11. Nginx+Keepalived 做负载均衡器
  12. Oracle 10g体系结构及安全管理
  13. 位运算,算术、逻辑运算详解-java篇
  14. 解决mysql连接报“Communications link failure”错误
  15. bootstrap 常用class
  16. Hive简单编程实践-词频统计
  17. Git学习之连接GitHub远程仓库
  18. java方法重载和重写
  19. LeetCode - 767. Reorganize String
  20. jq初入行常用动画

热门文章

  1. Unity3d通用工具类之NGUI图集分解
  2. 嵌入式linux GUI--DirectFB + GTK至尊秘笈
  3. 共享锁&amp;排它锁 || 乐观锁&amp;悲观索
  4. Informatica 常用组件Filter之一 概述
  5. WF4.0(3)----变量与参数
  6. kafka基本原理概述——patition与replication分配
  7. HDU 2825 Wireless Password【AC自动机+DP】
  8. IIS7.5配置Asp.net项目出现HTTP 错误 404.17 - Not Found 请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理。
  9. 【Python】得到当前日期时间
  10. JavaScript高级程序设计(第3版)学习笔记&#183;第8章——浏览器对象模型BOM