Strange behaviour with -charset filename=utf8

Started by Schmidtze, July 28, 2017, 12:19:53 PM

Previous topic - Next topic

Schmidtze

Hi,

I just discovered a strange behaviour when using "-charset filename=utf8" (of course with an arg file). Sometimes, I would say in 80%, I get the message that the file has not been found like this:

File not found: C:/_日本語.jpg'#$D#$A'File not found: C:/_日本語.jpg'#$D#$A


This only happens for files which has filenames with unicode characters, for example "_日本語.jpg" or "_äöüß.jpg". And very funny, or lets say fortunately, it works when executing ExifTool immediately again on the same file with the same arg file, with exactly the same code line. You can see it here (FApplication = ExifTool):

  ExecConsole(FApplication, sCommandLine + ' -charset filename=utf8 -@ "'
    + argFile + '"', FOutput, sWarningOrError, iExitCode);
  if Length(FOutput) = 0 then
    ExecConsole(FApplication, sCommandLine + ' -charset filename=utf8 -@ "'
      + argFile + '"', FOutput, sWarningOrError, iExitCode);


Very strange... Do you have an idea about that? For files with non unicode characters, always the first execution of ExifTool works, for all others very often the second execution has to be done...

The command line (sCommandLine in the code above) is:

-D -a -g2 -Error -Warning -c "%d deg %d'' %.2f"\" -all --exiftoolversion -s --iptc:all -execute -D -a -g2 -Error -Warning -L -s -iptc:all -common_args


Best regards
Friedemann

Phil Harvey

Hi Friedemann,

Very interesting.

What happens if you put the same filename in the argfile twice in the first execution?

Also, what happens if you execute this from the command line (cmd.exe) instead of exec-ing it from your app?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Schmidtze

Hi Phil,

oh man, totally strange, now I can't reproduce it anymore... But you see my code, it needed the second call, otherwise it didn't work. Now, at the moment, the second call is not used anymore, so the firts call always works already. Strange... I'm sorry for bothering you with this, but it defintely did the way I described 2 hours ago... I will keep any yes on it...

Best regards
Friedemann

Phil Harvey

Strange, but not totally unexpected.

What are you doing to the file before ExifTool is called?  If you are accessing the file before the exiftool call, it could trigger a virus scanner if you have one.  And if a virus scanner has the file open then the exiftool call may fail.  This may be any different for files with Unicode characters in their names because ExifTool uses a different o/s call to open these files.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Schmidtze

QuoteIf you are accessing the file before the exiftool call

no, I don't think so, my virus tool is deactivated at the moment for developing... And I created the arg file a few lines above the ExiFtool call by using a Windows API function for cerating a temp file...

Best regards
Friedemann