haijie1223 Posted March 5 Posted March 5 When the path contains Chinese, the output error message contains garbled characters. How can I solve this? In the attachment, run test.au3 and you can see the garbled characters in 1.txt. test.7z
argumentum Posted March 5 Posted March 5 (edited) the files does have a duplicate function name, but that is not the problem for you. Your problem is how it looks in the console no displaying the characters in your SciTE editor that is not even from this site, right ? Ok, so the redirect also gives the ?? instead of the characters. No clue 🤷♂️ Edited March 5 by argumentum 🤷♂️ Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
haijie1223 Posted March 5 Author Posted March 5 21 minutes ago, argumentum said: the files does have a duplicate function name, but that is not the problem for you. Your problem is how it looks in the console no displaying the characters in your SciTE editor that is not even from this site, right ? Ok, so the redirect also gives the ?? instead of the characters. No clue 🤷♂️ yes,it is.
ioa747 Posted March 5 Posted March 5 (edited) #include <AutoItConstants.au3> #include <FileConstants.au3> ; Define files Local $scriptFile = "测试.au3" Local $logFile = "1.txt" Local $pid = Run('"' & @AutoItExe & '" /ErrorStdOut "' & $scriptFile & '"', @ScriptDir, @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD) ProcessWaitClose($pid) Local $output = StdoutRead($pid) & StderrRead($pid) FileWrite($logFile, $output) ShellExecute($logFile) 1.txt "D:\_Test\??.au3" (4) : ==> Duplicate function name.: Func test() Edited March 5 by ioa747 add 1.txt I know that I know nothing
haijie1223 Posted March 5 Author Posted March 5 @ioa747 测试.au3 set any errors,then logs contains garbled characters。 argumentum 1
argumentum Posted March 5 Posted March 5 (edited) ..then is not a forum solution that you need but a bug report. And is better that you doit yourself because I'll never use that language and you can do a follow up on it Edited March 5 by argumentum added link Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Nine Posted March 5 Posted March 5 That works well : #include <FileConstants.au3> Local $scriptFile = "测试.au3" Local $logFile = "1.txt" Local $pid = ShellExecute($scriptFile) ProcessWait($pid) Local $hWnd = WinGetHandle("AutoIt Error") Local $sText = ControlGetText($hWnd, "", "Static2") WinClose($hWnd) Local $hFile = FileOpen($logFile, $FO_OVERWRITE + $FO_UTF8) FileWrite($hFile, $sText) FileClose($hFile) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
ioa747 Posted March 5 Posted March 5 (edited) I can't solve the problem, I can only overcome it. Local $originalFile = "测试.au3" Local $tempFile = "temp_syntax_check.au3" Local $logFile = "1.txt" FileCopy($originalFile, $tempFile, 1) Local $pid = Run('"' & @AutoItExe & '" /ErrorStdOut "' & $tempFile & '"', @ScriptDir, @SW_HIDE, 8) ; $STDERR_MERGED ProcessWaitClose($pid) Local $output = StdoutRead($pid) & StderrRead($pid) $output = StringReplace($output, $tempFile, $originalFile) Local $hFile = FileOpen($logFile, 2 + 128) ; $FO_OVERWRITE + $FO_UTF8 FileWrite($hFile, $output) FileClose($hFile) FileDelete($tempFile) ShellExecute('notepad.exe', $logFile) 1.txt "D:\_Test\测试.au3" (4) : ==> Duplicate function name.: Func test() alternative Local $scriptFile = "测试.au3" Local $logFile = "1.txt" ; Run Au3Check - It's designed for exactly this job Local $pid = Run('"' & StringReplace(@AutoItExe, "AutoIt3.exe", "Au3Check.exe") & '" "' & $scriptFile & '"', @ScriptDir, @SW_HIDE, 8) ; $STDERR_MERGED ProcessWaitClose($pid) Local $output = StdoutRead($pid) & StderrRead($pid) ; Write the output Local $hFile = FileOpen($logFile, 2 + 128) ; $FO_OVERWRITE + $FO_UTF8 FileWrite($hFile, $output) FileClose($hFile) ShellExecute($logFile) 1.txt AutoIt3 Syntax Checker v3.3.18.0 Copyright (c) 2007-2025 Tylo & AutoIt Team "测试.au3"(4,12) : error: test() already defined. Func test() ~~~~~~~~~~~^ 测试.au3 - 1 error(s), 0 warning(s) Edited March 5 by ioa747 I know that I know nothing
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now