原ASP代码:
Function UrlUncode(str)
okstr = ""
hexvalue = "&H"
starthx = 0
slen = len(str)
for i=1 to slen
c = mid(str,i,1)
if starthx = 0 then
if c="%" then
starthx = 1
else
okstr = okstr & c
end if
else
if c<>"%" then
hexvalue = hexvalue & c
end If
If len(hexvalue) = 4 then
If hexvalue<&H81 then
okstr = okstr & chr(hexvalue)
hexvalue = "&H"
starthx = 0
End If
End If
If len(hexvalue) = 6 then
okstr = okstr & chr(hexvalue)
hexvalue = "&H"
starthx = 0
End If
End if
next
UrlUncode = okstr
End Function
我转化的autoit函数代码:
Func UrlUncode($str)
$okstr = ""
$hexvalue = "&H"
$starthx = 0
$slen = StringLen ($str)
for $i=1 to $slen
$c = StringMid($str,$i,1)
if $starthx = 0 then
if $c="%" then
$starthx = 1
else
$okstr = $okstr & $c
EndIf
else
if $c<>"%" then
$hexvalue = $hexvalue & $c
EndIf
If StringLen($hexvalue) = 4 then
If $hexvalue<"&H81" then
$okstr = $okstr & chr($hexvalue)
$hexvalue = "&H"
$starthx = 0
EndIf
EndIf
If StringLen($hexvalue) = 6 then
$okstr = $okstr & chr($hexvalue)
$hexvalue = "&H"
$starthx = 0
EndIf
EndIf
next
Return $okstr
EndFunc