Passing filenames with Unicode characters to ExifTool

Started by stan, September 15, 2015, 09:29:39 PM

Previous topic - Next topic

stan

This is a two-part question:

1) How does one pass filenames with Unicode characters to ExifTool from the Windows command prompt? I added -charset filename=UTF8 and used tab completion to pass the proper filename (with Unicode characters) to the program, but it prints some other characters in place of the Unicode ones and complains about the file not being found.

2) I have multiple shortcuts to ExifTool in my Send To folder. The shortcuts are configured to carry out different operations based on the options I have added to each of their their Target fields. These shortcuts fail as well when I right-click filenames with Unicode characters and Send To ExifTool. Filenames without Unicode characters work fine. Again, how do I fix this?

Phil Harvey

1. I have no idea what encoding the tab completion would use, but presumably the encoding of the command processor.  Did you set this using "chcp 65001"?

2. You need to figure out how the file names are encoded, and set the -charset filename accordingly.  I can't be more specific right now without more details and testing.

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

stan



If I use chcp 65001 then tab completion no longer works and I can't type ï nor paste it.

I tried -charset filename=cp437 but that gave me an error. At a loss on how to proceed...

Phil Harvey

#3
I can't help much with how to generate proper UTF-8 characters on a Windows command line (other than what I have already written in FAQ 18).  But you can sidestep this issue by writing the file names to a UTF-8 encoded text file, then using the exiftool -@ option to read the arguments from the text file.

- Phil

Edit:  But wait.  Your first attempt worked (using the default code page 437).  Nothing was changed because the file contained no metadata.  Why don't you just do it this way?
...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 ($).

stan

Quote from: Phil Harvey on September 17, 2015, 07:42:19 AM
Edit:  But wait.  Your first attempt worked (using the default code page 437).  Nothing was changed because the file contained no metadata.  Why don't you just do it this way?
You're right, it does successfully update the files even when it throws a warning about the FileName encoding not being specified. On the other hand when the incorrect encoding is specified (in this case apparently UTF8 is wrong) then a File not found error is thrown, even though the name displayed (na∩ve.jpg) is the same as the one shown when UTF8 isn't specified.

I just wanted the files to be updated successfully without throwing those FileName encoding warnings. At least for this test file and the others I have, looks like -charset filename=cp1252 works for now. Thanks for your help with this.

Phil Harvey

Quote from: stan on September 17, 2015, 02:50:22 PM
On the other hand when the incorrect encoding is specified (in this case apparently UTF8 is wrong) then a File not found error is thrown, even though the name displayed (na∩ve.jpg) is the same as the one shown when UTF8 isn't specified.

Yeah, odd.

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

Mario Fagac

Hi,
I was able to solve such a problem with the help of a new setting for region system locale now with UTF-8 support available in Windows 10 version 20H2.
Best regards

StarGeek

Yes, that's posted quite a bit, usually with me pointing to this StackOverflow answer.

It may mess up spacing/fonts with some older programs, though.  For example, from an few months ago
Quote from: StarGeek on November 28, 2020, 06:56:56 PM
, but you may see some weirdness in other places.  For example, in the Ditto clipboard manager, some characters are displayed as this character �, but paste from the clipboard correctly.

YMMV
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype