Main Menu

characters question

Started by Iwonder, November 16, 2024, 04:07:12 AM

Previous topic - Next topic

Iwonder

Hello !

This is a "what's the reason why" question.

Working in Windows, command line or batch.

When, in command line, I am pasting :
exiftool -m -L -overwrite_original -XMP:CaptionWriter="Indexation © XXX Comité pour l'histoire" *.jpg(and, if and only if the "©" and "é" are displaying correctly), everything works fine.

But the same line in a batch file, doesn't add the correct symbols for these two characters.
when launching the batch (echo on), I can see that the "©" and "é" are not correctly displayed when the line is called, and other characters are added in the tag instead.
 
After having read Faq #10 (read but not fully understood), I tried lots of things without success.

By chance, I copied the line from the preview window in the explorer, and it pasted correctly in command line, and everything worked fine ! but I don't know why.

Can someone explain why it dosen't work in a batch ? (please, with simple words - I'm still a newbie in computer things, and I will stay forever).
Thank you for reading !
:)
French newbie
Other work as volunteer : https://btaliercio.wixsite.com/easy-greek-buttons/en

StarGeek

Quote from: Iwonder on November 16, 2024, 04:07:12 AMAfter having read Faq #10 (read but not fully understood), I tried lots of things without success.

It's actually FAQ #18, problems with special characters on the Windows command line that is relevent here. And yeah, I still don't fully understand all the character encoding stuff. I got things to work on my end and that's as deep down the rabbit hole as I was willing to go.

For your bat file, you might want to add
chcp 65001
at the beginning just in case.

Also, you want to make sure that the bat file is encoded as UTF8. I think notepad will do this by default, but a program such as Notepad++ will allow you to directly set the encoding.
edit: Notepad should be writing UTF8 by default as of May 2019, but you can directly set it when saving a file. There will be a drop down at the bottom of the save dialog that would let you change it.

The final option would be to use an ARGS file to write these characters. In that case, exiftool would be directly reading the file and the command line can't process and change anything before passing the data to exiftool.

Your ARGS file would look like this. I added an additional tag to make clear that every entry is a separate line. Also, you don't include quotes. See the -@ (Argfile) option and FAQ #27
-XMP:CaptionWriter=Indexation © XXX Comité pour l'histoire
-Description=My long description

And you command in the bat file would be this. The -L (latin) option is no longer needed as exiftool is reading directly from the ARGS file.
exiftool -m -overwrite_original -@ MyArgs.txt *.jpg
"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

Iwonder

@StarGeek
Hello friend !

Thanks ! activating the UTF-8 code page, makes it work like a charm !
Thank you, you are essential here !!!!

By default (Windows 10) .txt are saved as ANSI files. Before asking, I tried to save my batch file as a UTF-8 file, but this, all alone didn't work :)
See you !
Bernard

extra keywords for this post : accentuated, accents, non-english characters, French language
French newbie
Other work as volunteer : https://btaliercio.wixsite.com/easy-greek-buttons/en