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