[Lazarus] TProcess, UTF8, Windows

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Apr 12 22:20:16 CEST 2012


On Thu, 12 Apr 2012 12:34:59 -0300
Marcos Douglas <md at delfire.net> wrote:

> Hi,
> 
> I'm using the example in FreePascal wiki to execute external programs:
> http://wiki.freepascal.org/Executing_External_Programs#Reading_large_output
> 
> I adapted this code to work in LCL, using a simple TMemo.
> All "write" and "writeln" was replaced with
> Memo1.Lines.Append(ConsoleToUTF8(<text or variable>)).

What is the source of <text or variable>?
The output of the other process?
 
> Everything works fine... but since I changed this line:
> OurProcess.Options := [poUsePipes];
> to
> OurProcess.Options := [poUsePipes, poNoConsole];
> 
> ...the conversion ConsoleToUTF8 do not work.
> 
> Any tips?

Maybe the other process's output is not in console codepage.
Try

Memo1.Lines.Append(<text or variable>)
or
Memo1.Lines.Append(SysToUTF8(<text or variable>)).

Mattias




More information about the Lazarus mailing list