Ghost全自动系统备份光盘正式版 V4.5 | 硬盘版 V2.0 | 排行榜 TOP50 | 图文推荐 | 玩小游戏
首页 >> Asp编程 >> Asp实例教程 >> ASP中转换unicode编码为gb2312函数

ASP中转换unicode编码为gb2312函数

时间:2007-10-22 网友评论条 【

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("暗暗")
%>

站长工具
Google 相关搜索查询:
相关文章
loading 请稍等,评论加载中...

Aspxhome.com. 中国Asp之家. 版权所有

闽ICP备06017341号