编码乱码有关问题, 小弟我用 server.URLEncode(''")编码后,在request出现乱码
编码乱码问题, 我用 server.URLEncode(''")编码后,在request出现乱码
utf8 转换 修 字 编码 是 %E4%BF%AE
用gbk 页面获取 在用server.URLEncode 之后编码 换成这个%E4%BF%3F 了
这是怎么回事?
我用站长工具 编码 修 字确实是 %E4%BF%AE ,这个编码没问题啊
------解决思路----------------------
试试:
function urldecode(encodestr)
Dim newstr,havechar,lastchar,i,char_c,next_1_c,next_1_Num
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
utf8 转换 修 字 编码 是 %E4%BF%AE
用gbk 页面获取 在用server.URLEncode 之后编码 换成这个%E4%BF%3F 了
这是怎么回事?
我用站长工具 编码 修 字确实是 %E4%BF%AE ,这个编码没问题啊
------解决思路----------------------
试试:
function urldecode(encodestr)
Dim newstr,havechar,lastchar,i,char_c,next_1_c,next_1_Num
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