autoITnewbie Posted February 19, 2008 Share Posted February 19, 2008 (edited) Hi, I need help. I tried to read some chinese character being passed thru command line but it doesn't seem to work.script example: If $CmdLine[0] = 0 Then Exit(1)$CmdVars = $cmdlinefor $x = 1 to $cmdline[0] msgbox (0,'','command line: '&$x&' - '&$cmdline[$x]) NextExitrunning script:c:\temp\runUnicodeCmd.exe Trong tnh yu c?a h?n d?i Edited February 19, 2008 by autoITnewbie Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 20, 2008 Share Posted February 20, 2008 As far as I know, Windows doesn't support unicode command lines. Link to comment Share on other sites More sharing options...
MHz Posted February 20, 2008 Share Posted February 20, 2008 It may depend on the page set for the cmd prompt to the language. But I know that others have made unicode cmd scripts by using edit.com and save the script which creates a script with some strange characters representing the unicode that works as needed. Link to comment Share on other sites More sharing options...
Siao Posted February 20, 2008 Share Posted February 20, 2008 (edited) Depends on how you are passing command line. "Command Prompt" console window does not support Unicode. Windows support Unicode, and command line with Unicode chars get passed to the app just fine. Then it's just a question of whether the app supports Unicode. However, displaying Chinese requires additional files. Control Panel > Regional and Language Options > Languages > Install files for East Asian languages. (That's for WinXP at least, for other OSes the steps may be different). Edited February 20, 2008 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
autoITnewbie Posted February 21, 2008 Author Share Posted February 21, 2008 (edited) Thanks everyone, I was able to collect the unicode passed from commandline using our inhouse tool into an ini file saved as Encoding of UTF-8 but now I have a problem another problem when I try to read it back or try to get certain value from that ini file. it does not show the characters.I tried to convert the ini file from unicode to ansi file using dos command "type" but when reading it, it does not show the correct characters =(I'm not sure if iniread does not support unicode or is it msgbox does not display unicode?Any thoughts?Depends on how you are passing command line."Command Prompt" console window does not support Unicode.Windows support Unicode, and command line with Unicode chars get passed to the app just fine. Then it's just a question of whether the app supports Unicode.However, displaying Chinese requires additional files. Control Panel > Regional and Language Options > Languages > Install files for East Asian languages. (That's for WinXP at least, for other OSes the steps may be different). Edited February 21, 2008 by autoITnewbie Link to comment Share on other sites More sharing options...
MHz Posted February 21, 2008 Share Posted February 21, 2008 I'm not sure if iniread does not support unicode or is it msgbox does not display unicode?Any thoughts?Msgbox does not support unicode AFAIK. Others have read UTF-8 files so I would keep trying. Try your example and replace the msgbox with FileOpen/FileWrite/FileClose in unicode mode to see the result. Hopefully, someone with some chinese language experience may come to help you soon. Link to comment Share on other sites More sharing options...
Siao Posted February 21, 2008 Share Posted February 21, 2008 Unicode version of AutoIt uses unicode versions of API functions (such as MessageBoxW instead of MessageBox), so that's NOT the problem.Converting unicode to ansi, reading the result and then expecting to see unicode correctly is a weird idea too.Instead of speaking in general terms, better try to post the code of what and how you are trying and failing to do, so we can get better idea.For example the following script for me displays chinese correctly.If $CmdLine[0] Then ;;display commandline arguments $str = "" For $i = 1 To $CmdLine[0] $str &= $i & ": " & $CmdLine[$i] & @CRLF Next MsgBox(0, "Command line", $str) Else ;;self execute with some commandline argument ShellExecute(@AutoItExe, '"' & @ScriptFullPath & '" 知识') EndIf "be smart, drink your wine" Link to comment Share on other sites More sharing options...
autoITnewbie Posted February 21, 2008 Author Share Posted February 21, 2008 I don't know what happened but I tried your script and here is what I got result Unicode version of AutoIt uses unicode versions of API functions (such as MessageBoxW instead of MessageBox), so that's NOT the problem. Converting unicode to ansi, reading the result and then expecting to see unicode correctly is a weird idea too. Instead of speaking in general terms, better try to post the code of what and how you are trying and failing to do, so we can get better idea. For example the following script for me displays chinese correctly. If $CmdLine[0] Then ;;display commandline arguments $str = "" For $i = 1 To $CmdLine[0] $str &= $i & ": " & $CmdLine[$i] & @CRLF Next MsgBox(0, "Command line", $str) Else ;;self execute with some commandline argument ShellExecute(@AutoItExe, '"' & @ScriptFullPath & '" 知识') EndIf Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 22, 2008 Share Posted February 22, 2008 That means the run box doesn't support unicode. Link to comment Share on other sites More sharing options...
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