回复 happytc
在当前的网页编码模式下只能用我一楼的方法 BinaryToString 贴出源字符
afan 发表于 2011-11-5 01:02
嗯,那就用这种形式吧,还不用存au3为utf8了
#Include <WinAPI.au3>
#include <Array.au3>
$str = BinaryToString('0x00A0', 3)
;$str = ChrW(AscW('a'))
Local $aResult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", 0, "dword", 0, "wstr", $str, "int", -1, "ptr", 0, _
"int", 0, "ptr", 0, "ptr", 0)
Local $tMultiByte = DllStructCreate("char[" & $aResult[0] & "]")
Local $pMultiByte = DllStructGetPtr($tMultiByte)
Local $tBool = DllStructCreate("BOOL")
$aResult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", 0, "dword", 0, "wstr", $str, "int", -1, "ptr", $pMultiByte, _
"int", $aResult[0], "ptr", 0, "ptr", DllStructGetPtr($tBool))
Local $Flag = DllStructGetData($tBool, 1)
If $Flag Then
MsgBox(0, $Flag, "至少有一个字符不能被成功转换为相对应的多字节形式")
Else
MsgBox(0, $Flag, "全部可以由宽字符转为ansi")
EndIf
|