Windows exiftool.exe can't run from folders containing non-code-page characters

Started by johnrellis, January 14, 2018, 01:46:46 AM

Previous topic - Next topic

johnrellis

Not sure if this is a known issue:

On Windows, "exiftool.exe" won't run correctly if it resides in a folder whose path contains arbitrary Unicode characters not in the current system code page -- it exits immediately with exit code -1.

In my use case, users install my Lightroom plugin (containing "exiftool.exe") in a folder of their choice (as they do with all plugins), typically in a subfolder of their user folder. If their username contains Unicode characters not in the system code page, then "exiftool.exe" fails to run.

To reproduce the problem, download "exiftoolbug.zip": https://www.dropbox.com/s/z8lxfmxf3pl5muf/exiftoolbug.zip?dl=0 . Unzip it, cd to the unzipped "exiftoolbug" folder, and run "exiftoolbug.bat".  Here's sample output:


T:\Desktop\exiftoolbug>exiftoolbug.bat

T:\Desktop\exiftoolbug>chcp 65001
Active code page: 65001

T:\Desktop\exiftoolbug>copy exiftool.exe subfolder
        1 file(s) copied.

T:\Desktop\exiftoolbug>cd subfolder

T:\Desktop\exiftoolbug\subfolder>.\exiftool.exe -ver -echo "From subfolder"
From subfolder
10.75

T:\Desktop\exiftoolbug\subfolder>echo ERRORLEVEL 0
ERRORLEVEL 0

T:\Desktop\exiftoolbug\subfolder>del exiftool.exe

T:\Desktop\exiftoolbug\subfolder>cd ..

T:\Desktop\exiftoolbug>copy exiftool.exe subfolder鈒
        1 file(s) copied.

T:\Desktop\exiftoolbug>cd subfolder鈒

T:\Desktop\exiftoolbug\subfolder鈒>.\exiftool.exe -ver -echo "From subfolder鈒"

T:\Desktop\exiftoolbug\subfolder鈒>echo ERRORLEVEL -1
ERRORLEVEL -1

T:\Desktop\exiftoolbug\subfolder鈒>del exiftool.exe

T:\Desktop\exiftoolbug\subfolder鈒>cd ..

Phil Harvey

Thanks for this report.

This isn't a known issue.

I'll look into this, but I don't know if there is much I can do about it.

I'll post back here with any questions/comments/discoveries.

- 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 ($).

johnrellis

You're likely already thinking this, but perhaps it's caused by the Active Perl startup getting the current directory as 8-bit characters rather than as UTF-16 and then getting confused.

The problem doesn't appear to be related to the use of "cmd.exe".  I created the ExifTool process directly using a C program and still observed the problem:

#include "stdafx.h"
#include <stdio.h>
#include <process.h>   

int main() {
    _wspawnl (_P_WAIT,   
        L"c:\\users\\john\\applylut鈒.lrdevplugin\\exiftool.exe",
//        L"c:\\users\\john\\applylut.lrdevplugin\\exiftool.exe",
        L"exiftool",
        NULL);}