asp urlDecode 在国外主机中文乱码
<%
Function urlDecode(enStr)
dim deStr,c,i,v : deStr=""
for i=1 to len(enStr)
c=Mid(enStr,i,1)
if c="%" then
v=eval("&h"+Mid(enStr,i+1,2))
if v<128 then
deStr=deStr&chr(v) : i=i+2
else
if isValidateHex(mid(enstr,i,3)) then
if isValidateHex(mid(enstr,i+3,3)) then v=eval("&h"+Mid(enStr,i+1,2)+Mid(enStr,i+4,2)) : deStr=deStr&chr(v) : i=i+5 else v=eval("&h"+Mid(enStr,i+1,2)+cstr(hex(asc(Mid(enStr,i+3,1))))) : deStr=deStr&chr(v) : i=i+3
else
destr=destr&c
end if
end if
else
if c="+" then deStr=deStr&" " else deStr=deStr&c
end if
Next
urlDecode=deStr
End Function
Function isValidateHex(str)
dim c
isValidateHex=true
str=ucase(str)
if len(str)<>3 then isValidateHex=false:exit function
if left(str,1)<>"%" then isValidateHex=false:exit function
c=mid(str,2,1)
if not (((c>="0") and (c<="9")) or ((c>="A") and (c<="Z"))) then isValidateHex=false:exit function
c=mid(str,3,1)
if not (((c>="0") and (c<="9")) or ((c>="A") and (c<="Z"))) then isValidateHex=false:exit function
End Function
response.write(urlDecode("%D3%A2%B3%AC%BE%AB%BB%AA%0D%0A"))
%>
解码 显示都是问号啊