I am trying to read the Output from the WScript.Shells Exec return value. Some lines contain Chinese/German/Cyrillic characters Like this:
Glas für Rahmen
The problem is, that I receive the "wrong" characters in my VBA Script.
Can I alter the charset of my StdOut
? The Developer of the executable, which I start via the WScript.Shell, ensured, that the output is UTF8.
If I start the executable in the CMD I can see the correct characters.
Private oShell As Variant
Private Sub Class_Initialize()
Set oShell = CreateObject("WScript.Shell")
End Sub
Public Function StartExeAndGetOutput(executable As String, arguments As String) As String
Dim returnValue As Object
Set returnValue = oShell.Exec(executable & " " & arguments)
Dim oOutput As Object
Set oOutput = returnValue.StdOut
Dim s As String
Dim sLine As String
While Not oOutput.AtEndOfStream
sLine = oOutput.ReadLine
If sLine <> "" Then s = s & sLine & vbCrLf
Wend
StartExeAndGetOutput = s
End Function