“%D6%D0%CE%C4”这不是"中国"编码,而是"中文"的编码 试试下面的脚本
MsgBox(0,0,UrlEncode("中国"))
Func UrlEncode($Url)
Local $UrlLen
$UrlLen = StringLen($Url)
Local $EnStr,$UrlChar,$EnStr
For $i = 1 To $UrlLen Step 1
$UrlChar = StringMid($Url, $i, 1)
if ascw($UrlChar) > 256 Then
$str =StringReplace(StringToBinary($UrlChar&" ",1),"0x","")
$EnStr &= "%"&StringLeft($str,2) & "%"&StringRight($str,2)
Else
$str =StringReplace(StringToBinary($UrlChar),"0x","")
$EnStr &= "%"&$str
EndIf
Next
Return "0x"&$EnStr
EndFunc
[ 本帖最后由 auto 于 2008-7-21 19:43 编辑 ] |