回复 5# kxing
9#,你没看错吧;例子:
$str = "盗墓笔记5"
$str1 = _UnicodeURLEncode($str)
MsgBox(0, '转换前后', $str & @CRLF & $str1)
ShellExecute('http://so.tudou.com/isearch/' & $str1)
Func _UnicodeURLEncode($UnicodeURL) ;==>_UnicodeURLEncode
Local $UnicodeBinaryLength, $UnicodeBinary, $UnicodeBinary2
$UnicodeBinary = StringToBinary($UnicodeURL, 4)
$UnicodeBinary2 = StringReplace($UnicodeBinary, '0x', '', 1)
$UnicodeBinaryLength = StringLen($UnicodeBinary2)
Local $EncodedString, $UnicodeBinaryChar, $EncodedString
For $i = 1 To $UnicodeBinaryLength Step 2
$UnicodeBinaryChar = StringMid($UnicodeBinary2, $i, 2)
If StringInStr("$-_.+!*'(),;/?:@=&abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", BinaryToString('0x' & $UnicodeBinaryChar, 4)) Then
$EncodedString &= BinaryToString('0x' & $UnicodeBinaryChar)
Else
$EncodedString &= '%' & $UnicodeBinaryChar
EndIf
Next
Return $EncodedString
EndFunc ;==>_UnicodeURLEncode
|