strSpecial = "!""#$%&'()*+,/:;<=>?@[\]^`{|}~%" 这些都要变成对应的ASCII码,以下是vbscript代码function urlencoding(vstrin) dim i,strreturn,strSpecial strSpecial = "!""#$%&'()*+,/:;<=>?@[\]^`{|}~%" strreturn = "" for i = 1 to len(vstrin) thischr = mid(vstrin,i,1) if abs(asc(thischr)) < &hff then if thischr=" " then strreturn = strreturn & "+" elseif instr(strSpecial,thischr)>0 then strreturn = strreturn & "%" & hex(asc(thischr)) else strreturn = strreturn & thischr end if else innercode = asc(thischr) if innercode < 0 then innercode = innercode + &h10000 end if hight8 = (innercode and &hff00)\ &hff low8 = innercode and &hff strreturn = strreturn & "%" & hex(hight8) & "%" & hex(low8) end if next urlencoding = strreturn end function
:)
以前我这样做过,asp查IP中的一部分
这些都要变成对应的ASCII码,以下是vbscript代码function urlencoding(vstrin)
dim i,strreturn,strSpecial
strSpecial = "!""#$%&'()*+,/:;<=>?@[\]^`{|}~%"
strreturn = ""
for i = 1 to len(vstrin)
thischr = mid(vstrin,i,1)
if abs(asc(thischr)) < &hff then
if thischr=" " then
strreturn = strreturn & "+"
elseif instr(strSpecial,thischr)>0 then
strreturn = strreturn & "%" & hex(asc(thischr))
else
strreturn = strreturn & thischr
end if
else
innercode = asc(thischr)
if innercode < 0 then
innercode = innercode + &h10000
end if
hight8 = (innercode and &hff00)\ &hff
low8 = innercode and &hff
strreturn = strreturn & "%" & hex(hight8) & "%" & hex(low8)
end if
next
urlencoding = strreturn
end function