ASP中转换unicode编码为gb2312函数

时间:2007-10-22 17:46:00 

ASP中转换unicode编码为GB编码方法:


<%
function urldecode(encodestr) 
newstr="" 
havechar=false 
lastchar="" 
for i=1 to len(encodestr) 
char_c=mid(encodestr,i,1) 
if char_c="+" then 
newstr=newstr & " " 
elseif char_c="%" then 
next_1_c=mid(encodestr,i+1,2) 
next_1_num=cint("&H" & next_1_c) 
if havechar then 
havechar=false 
newstr=newstr & chr(cint("&H" & lastchar & next_1_c)) 
else 
if abs(next_1_num)<=127 then 
newstr=newstr & chr(next_1_num) 
else 
havechar=true 
lastchar=next_1_c 
end if 
end if 
i=i+2 
else 
newstr=newstr & char_c 
end if 
next 
urldecode=newstr 
end function 
response.write urldecode("%B0%B5%B0%B5")
response.write Server.URLEncode("暗暗")
%>


标签:unicode,gb,编码
0
投稿

猜你喜欢

  • Asp中Server.ScriptTimeOut脚本超时属性需要注意的一点

    2008-10-18 14:53:00
  • asp如何防止计数器刷新计数?

    2009-11-22 19:19:00
  • 页面重构中的组件制作要点

    2009-10-25 13:06:00
  • 前端开发中一些常用技巧总结

    2010-07-18 13:13:00
  • 轻松解决:mysql数据库连接过多的错误

    2010-09-30 14:28:00
  • ASP设计常见问题及解答精要

    2009-04-21 11:16:00
  • 一个挺酷的星级投票效果

    2010-08-03 12:44:00
  • 分析SQL语句性能3种方法分享

    2012-06-06 20:09:30
  • SQL语句练习实例之四 找出促销活动中销售额最高的职员

    2011-11-03 16:47:03
  • 客户端和服务端的编码“陷阱”

    2007-12-21 19:19:00
  • SQL进行排序、分组、统计的10个新技巧

    2009-01-23 13:59:00
  • 巧用一条SQL 实现其它进制到十进制转换

    2009-01-19 13:16:00
  • js随机永不重复数

    2011-04-25 19:26:00
  • 一个不错的js软键盘代码而且移植方便

    2007-08-14 12:56:00
  • ASP JSON类文件的使用方法

    2011-04-30 16:39:00
  • AJAX实现延时顺序请求多个URL

    2007-12-06 18:32:00
  • [翻译]JavaScript中对象的层次与继承

    2008-12-31 13:36:00
  • CSS缩写可以有效的缩小CSS文件的体积

    2009-01-13 18:06:00
  • 产品列表到底应该怎么做?

    2009-01-02 16:34:00
  • 表单验证中时间起止判断的递归处理

    2009-12-16 19:27:00
  • asp之家 网络编程 m.aspxhome.com