请教关于URLDecode的问题
在AutoIt中,_UnicodeURLDecode对符号Decode没问题,但是对文字总是不能正确解码,比如将“%E4%B8%AD%E5%9B%BD” 解码成“中国”
_UnicodeURLDecode("%E4%B8%AD%E5%9B%BD")总是为空。请教如何解决这个问题。
我的_UnicodeURLDecode方法如下:
Func _UnicodeURLDecode($toDecode)
Local $strChar = "", $iOne, $iTwo
Local $aryHex = StringSplit($toDecode, "")
For $i = 1 To $aryHex
If $aryHex[$i] = "%" Then
$i = $i + 1
$iOne = $aryHex[$i]
$i = $i + 1
$iTwo = $aryHex[$i]
$strChar = $strChar & Chr(Dec($iOne & $iTwo))
Else
$strChar = $strChar & $aryHex[$i]
EndIf
Next
$Process = StringToBinary(StringReplace($strChar, "+", " "))
$DecodedString = BinaryToString($Process, 4)
Return $DecodedString
EndFunc
[ 本帖最后由 robin.von 于 2008-12-11 17:05 编辑 ] $x=UrlEnc('上海')
MsgBox(32,"上海",$x)
MsgBox(32,"上海",UrlDec($x))
Func UrlEnc($Sz_url)
Local $str=StringTrimLeft(StringToBinary($Sz_url,4),2)
Local $ret
For $i=1 to StringLen($str) Step 2
$ret &='%' & StringMid($str,$i,2)
Next
Return $ret
EndFunc
Func UrlDec($Sz_url)
Local $str='0x' & StringReplace($Sz_url,"%","")
Local $ret=BinaryToString($str,4)
Return $ret
EndFunc 原帖由 thesnow 于 2008-12-11 12:49 发表 http://www.autoitx.com/images/common/back.gif
$x=UrlEnc('上海')
MsgBox(32,"上海",$x)
MsgBox(32,"上海",UrlDec($x))
Func UrlEnc($Sz_url)
Local $str=StringTrimLeft(StringToBinary($Sz_url,4),2)
Local $ret
For $i=1 t ...
谢谢,问题解决了! 此贴管用 也解决了我的问题 正好用上哈哈 不错不错 打酱油的,混点分数提高下等级,谁然我是路过,但是也不是水帖子
Dragon Nest Gold,vindictus gold,swg credits,silkroad gold,NosTale Gold,Knight Noah,Eden Eternal gold, Elsword ED,tibia gold,shaiya gold,rs2 gold,rohan gold,RIFT Platinum,RIFT Plat,RIFT Gold,rappelz gold,rappelz rupees,perfect world gold,pw gold,Metin2 Yang,Metin2 Gold,maplestory mesos,mabinogi gold,lineage 2 adena,guild wars gold,ffxiv gil,ffxi gil,2moons dil, 4story money, 4story Luna, 4Story Gold, 9Dragons gold, Aion Kinah, Buy Aion Kinah, Buy Aion Gold, apb gold, Cabal Alz, Cabal Gold, dfo gold, dofus kamas, EVE ISK, eq2 plat,
页:
[1]