Func _StringToCodepage($sStr, $iCodepage) Local $aResult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $iCodepage, "dword", 0, "wstr", $sStr, _ "int", StringLen($sStr), "ptr", 0, "int", 0, "ptr", 0, "ptr", 0) Local $tCP = DllStructCreate("char[" & $aResult[0] & "]") $aResult = DllCall("Kernel32.dll", "int", "WideCharToMultiByte", "uint", $iCodepage, "dword", 0, "wstr", $sStr, _ "int", StringLen($sStr), "struct*", $tCP, "int", $aResult[0], "ptr", 0, "ptr", 0) Return DllStructGetData($tCP, 1) EndFunc ;==>_StringToCodepage $cp = DllCall("kernel32.dll", "int", "GetACP") ConsoleWrite("Default Codepage: " & $cp[0] & @CRLF) ConsoleWrite('----------------' & @CRLF) ; Unicode: U+4E2D U+6587 $strA = "中文" ConsoleWrite("$strA: " & $strA & @CRLF) ConsoleWrite(String(StringToBinary($strA)) & @CRLF) ConsoleWrite('----------------' & @CRLF) $strB = _StringToCodepage($strA, 65001) ConsoleWrite("$strB: " & $strB & @CRLF) ConsoleWrite(String(StringToBinary($strB)) & @CRLF) ConsoleWrite('----------------' & @CRLF)