海南世纪云图网络科技有限公司
咨询热线:400-822-8458 客户服务:0898-32183600

ASP函数实现unicode转gb2312

发表于:2010-12-16 00:00:00来源:人气:3911

ASP中自带的函数Server.URLEncode可以方便的对字符串进行编码,这里提供一个函数可以将unicode编码转为为gb2312编码

<%
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

%>

文章整理: 世纪云图  https://www.yuntop.cc/

以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

版权申明:本站文章部份来自网络,如有侵权,请联系我们,我们收到后立即删除,谢谢!

特别注意:本站部份转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有。

微信
网站建设
软件业务
网络营销
400电话