Forum > LazUtils

Passing Unicode filenames to TUTF8Process

(1/4) > >>

Mike.Cornflake:
Having a problem with unicode filenames (again with mplayer) on Windows 8 64bit running Lazarus 32bit Trunk/FPC Trunk...


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

  FPlayerProcess.Execute;
--- End code ---
If I pass a non-unicode filename to this, everything works, and I get the following by querying FPlayerProcess.output

--- Quote ---MPlayer Redxii-SVN-r37216-4.8.2 (i686) (C) 2000-2014 MPlayer Team
Compiled against FFmpeg version N-63644-ge1bd40f
Build date: Sat May 31 22:08:38 EDT 2014

Playing B:\Code\Compile\Test Data\Clip_1080_5sec_VC1_15mbps.wmv.
...
--- End quote ---
On the other hand, if I pass a file with a unicode name ("skiing - ǤǥǦ.avi") into the procedure, then instead I see

--- Quote ---MPlayer Redxii-SVN-r37216-4.8.2 (i686) (C) 2000-2014 MPlayer Team
Compiled against FFmpeg version N-63644-ge1bd40f
Build date: Sat May 31 22:08:38 EDT 2014

Playing B:\Code\Compile\Test Data\skiing - ǤǥǦ.avi.

Exiting... (End of file)
--- End quote ---
I've confirmed from the command line that mplayer itself will play the file with the unicode filename.   So it's looks like it's down to my handling of unicode filenames.  Somehow I'm mangling "skiing - ǤǥǦ.avi" into "skiing - ǤǥǦ.avi"

I've tried this with both

--- Code: ---  FPlayerProcess.Parameters.Add(AnsiToUTF8(Filename)); // mplayer reports can't find "skiing - ǤǥǦ.avi"
and
  FPlayerProcess.Parameters.Add(Filename);  // mplayer reports can't find "skiing - GgG.avi"
--- End code ---

I've also tried UTF8ToAnsi, and UTF8ToSys (both of which return "skiing - GgG.avi")...

Incidently in ALL cases, the Process ends with both an exitcode and exitstatus of 0.

So, how do I pass a Unicode filename into UTF8Process.Parameters?

bigeno:
Did you try TProcess (not TProcessUTF8) and UTF8ToSys ?

Mike.Cornflake:
I tried UTF8ToSys (and SysToUTF8).  No banana's each time :-(

I didn't try TProcess, do you have experience of it working with unicode paramaters?

Bart:
AFAIK yo do not need to use Utf8ToSys, just supply the name as UTF8, the conversion is done inside the TProcessUtf8.

Bart

bigeno:

--- Quote from: Mike.Cornflake on June 28, 2014, 11:40:54 pm ---I tried UTF8ToSys (and SysToUTF8).  No banana's each time :-(

I didn't try TProcess, do you have experience of it working with unicode paramaters?

--- End quote ---
I use TProcessUTF8 without problems, (but not for mplayer), If you use TProcessUTF8 then you need UTF8 Parameters, you can't use UTF8ToSys, for that use TProcess. If command line works then Sys encoding works, hm... Can you remove spaces (from file name) for test  ?

Navigation

[0] Message Index

[#] Next page

Go to full version