这是一个将中文转换成UTF8的函数,我想要转换成ANSI(gb2312)编码,求啊!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
|