ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Adam on April 18, 2022, 02:03:37 PM

Title: Cannot send UTF8 filename via open process on Windows
Post by: Adam on April 18, 2022, 02:03:37 PM
I am trying to add this tool to a program via Qt with the ZExifToolProcess wrapper. On Mac everything works fine, but on Windows I am unable to get certain characters to load.

Now this doesn't seem just like a Qt issue since the base program by itself runs into the same issue. Specifically I'm trying to load "レッサーパンダ.png" and the output is as follows:


PS C:\Users\Adam\Pictures\Debug\ümlaut> exiftool レッサーパンダ.png
No matching files

(Note I have this in a folder with a ü in it because I was originally testing that not working, keeping it in in case it's related.)

I've also tried adding on "-charset filename=utf8" which doesn't help. It just changes the error to this (console here can't print the Japanese characters):


Invalid filename encoding for C:/Users/Adam/Pictures/Debug/\xFCmlaut/???????.png\nNo matching files\n


From the Qt application I can see that it is passing in the following:


-json\n-binary\n-G0\nC:/Users/Adam/Pictures/Debug/\xC3\xBCmlaut/\xE3\x83\xAC\xE3\x83\x83\xE3\x82\xB5\xE3\x83\xBC\xE3\x83\x91\xE3\x83\xB3\xE3\x83\x80.png\n-echo1\n{await0000000001}\n-echo2\n{await0000000001}\n-echo4\n{ready}\n-execute\n


When I take that hex data and put it into a UTF8 validator it validates and displays fine. So I'm pretty sure it's passing in the right bytes at least. Is there something else I'm missing with Windows weirdness?
Title: Re: Cannot send UTF8 filename via open process on Windows
Post by: StarGeek on April 18, 2022, 02:11:53 PM
See FAQ #18 (https://exiftool.org/faq.html#Q18).  Windows command line does not deal well with anything but simple characters.  FAQ #18 gives some options that may work for you.  Myself, it never worked on my computer.  I had to use this StackOverflow answer (https://stackoverflow.com/questions/57131654/using-utf-8-encoding-chcp-65001-in-command-prompt-windows-powershell-window/57134096#57134096).
Title: Re: Cannot send UTF8 filename via open process on Windows
Post by: Adam on April 18, 2022, 03:19:43 PM
Thank you for the links. I had to fiddle around with it some more, but I finally tried changing the arguments in the process write call to be "-@ file.txt" with my actual args in the file and it seems to work now. It took me a while to try this because I had already used -@ at the instantiation of the external process and wasn't sure it would work twice.

Thanks again!
Title: Re: Cannot send UTF8 filename via open process on Windows
Post by: StarGeek on April 18, 2022, 03:48:42 PM
Glad you figured it out.  I had thought that might be the way to go but wasn't sure enough to add that.  I'll remember that if it comes up again.