Modify

Opened 15 years ago

Closed 15 years ago

Last modified 5 years ago

#1512 closed Bug (No Bug)

StdoutRead no correct output with german language OS

Reported by: Emiel Wieldraaijer Owned by:
Milestone: Component: AutoIt
Version: 3.3.4.0 Severity: None
Keywords: StdoutRead Cc:

Description

Hi,

StdoutRead does not produce the correct output
I've an image with the correct output.

Console Output =

"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "Z:\Proggen\CheckDisk\chktest.au3" /autoit3dir "C:\Program Files (x86)\AutoIt3" /UserParams

+>13:39:42 Starting AutoIt3Wrapper v.2.0.0.3 Environment(Language:0409 Keyboard:00020409 OS:WIN_VISTA/ CPU:X64 OS:X64)

Running AU3Check (1.54.19.0) from:C:\Program Files (x86)\AutoIt3

+>13:39:42 AU3Check ended.rc:0

Running:(3.3.4.0):C:\Program Files (x86)\AutoIt3\autoit3.exe "Z:\Proggen\CheckDisk\chktest.au3"

3240
C:\Windows\system32\cmd.exe /c chkdsk c:
StdoutRead: Zugriff verweigert, das Sie nicht ber ausreichende Berechtigungen verfgen.
Sie mssen dieses Programm mit erh”hten Rechten ausfhren.

+>13:39:43 AutoIT3.exe ended.rc:0
+>13:39:44 AutoIt3Wrapper Finished

Exit code: 0 Time: 1.866

[code example] (not mine)
#include <Constants.au3>
Local $foo, $cmd
Local $line
$cmd = @ComSpec & " /c chkdsk c:"
$foo = Run($cmd, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

dbg($foo)
dbg($cmd)
While 1

$line = StdoutRead($foo)
If $line<>"" Then

dbg("StdoutRead: " & $line)

EndIf
If Not ProcessExists($foo) Then

ExitLoop

EndIf

Wend

Exit

Func dbg($msg, $error=@error, $extended=@extended, $ScriptLineNumber=@ScriptLineNumber)

Local $out = "(" & $ScriptLineNumber & ")(" & $error & ")(" & $extended & ") := " & $msg
ConsoleWrite($msg & @CRLF)
DllCall("kernel32.dll", "none", "OutputDebugString", "str", $out)

EndFunc

Thanks

Emiel

Attachments (1)

Correct.jpg (76.4 KB) - added by ewieldra 15 years ago.

Download all attachments as: .zip

Change History (6)

Changed 15 years ago by ewieldra

comment:1 Changed 15 years ago by doudou

It's nothing to do with StdoutRead(): chkdsk and many other command line utilities shipped with Windows use traditionally OEM charset, while AutoIt (as primarily GUI app) uses ANSI or corr. Windows codepage.

You have to apply a charset conversion before using OEM strings in AutoIt, something like:

$ret = DllCall("user32.dll", "BOOL", "OemToCharW", "wstr", $line, "wstr", "")
If $ret[0] Then $line = $ret[2]

comment:2 Changed 15 years ago by Jpm

  • Resolution set to No Bug
  • Status changed from new to closed

Thanks Doudou for helping Just a small typo

$ret = DllCall("user32.dll", "BOOL", "OemToCharW", "str", $line, "wstr", "")

comment:3 Changed 15 years ago by Emiel Wieldraaijer

Thanks,

I thought it was another unicode problem

comment:4 follow-up: Changed 5 years ago by anonymous

$ret = DllCall("user32.dll", "BOOL", "OemToCharW", "str", $line, "wstr", "")

Didn't work with Vietnamese. Any idea ?

comment:5 in reply to: ↑ 4 Changed 5 years ago by Jos

Replying to anonymous:

$ret = DllCall("user32.dll", "BOOL", "OemToCharW", "str", $line, "wstr", "")

Didn't work with Vietnamese. Any idea ?

This is not a place to ask questions, please use our forum for that.

Jos

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.