[Lazarus] LazUtils - TProcessUTF8 - UTF8 Parameters issue

Michael Thompson mike.cornflake at gmail.com
Sat Jun 28 22:18:01 CEST 2014


Can anyone confirm if TProcessUTF8 handles unicode parameters under windows?

I'm using Win 8 64bit/Laz 32 bit trunk/FPC Trunk.  I'm struggling here with
no unicode background, reading madly and hunting away...

http://wiki.lazarus.freepascal.org/LCL_Unicode_Support makes it clear FPC
is not unicode aware, though good improvements are being made in trunk...

I've traced through the code as best I can - TProcessUTF8 descends from
TProcess.  The overriden .Execute in TProcessUTF8, calls TProcess.Execute.
 Inside TProcess.Execute (win\process.inc) CreateProcess is called (which
looks very much like it calls CreateProcessA, not CreateProcessW).  And all
the relevant parameters involved are PChars, whereas I think CreateProcessW
will require PWideChars, confirming the CreateProcessA suspicion.

As I understand things, we'll need TProcess to be unicode aware before
TProcessUTF8 itself is fully unicode aware....

My issue is down to a unicode filename being passed through as a parameter

Var
  FPlayerProcess: TProcessUTF8;
...
  FPlayerProcess.Executable:=FMPlayerPath;
  FPlayerProcess.Parameters.Add(AnsiToUTF8(Filename));

mplayer is reporting it can't find a corrupted version of the Filename I
pass through.  Works just fine with non-unicode filenames... (and I can
pass mplayer the unicode filename in Command Prompt and it works there)

If someone could confirm my suspicions that TProcessUTF8 is likely the
problem, I'll stop trying to fix the code at my end, and just put this down
as a known issue for now (sure, and I'll log an item in the bugtracker
though I can't see how to easily create a small test :) )...  OTOH, if I'm
completely wrong, I'll continue to slog away...

Many thanks

Mike T
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20140628/b07c6b5e/attachment-0002.html>


More information about the Lazarus mailing list