ExifTool Forum

ExifTool => Newbies => Topic started by: sylf on December 12, 2021, 11:03:57 AM

Title: Command-line - Windows : fight against character encoding problem or accept it?
Post by: sylf on December 12, 2021, 11:03:57 AM
Hi.
Very happy with Exiftool delivering nice XML metadata files.
Concerning the encoding of characters, these two output examples :
<IPTC2:Caption-Abstract>Degustation d&#39;une Barrique</IPTC2:Caption-Abstract>
"d&#39;" should be "d'"
<IPTC2:DocumentHistory>r23 mai 2003 10:31:54  Texte enregistrŽ</IPTC2:DocumentHistory>
"enregistrŽ" should be "enregistré"
I read topic https://exiftool.org/faq.html#Q10. But it is a little too tricky for me. Let's say I'd like to use this command :
exiftool.pl -@ C:\dir1\dir2\list_of_image_paths.txt -X -w C:\dir3\dir4\%f.xml
Would you suggest me to test a specific parameter to get the right encoding : "d'" and "enregistré"?
Or is this so tricky that I would better live with this encoding problem?
Best,
Sylvain
Title: Re: Command-line - Windows : fight against character encoding problem or accept it?
Post by: StarGeek on December 12, 2021, 11:23:01 AM
FAQ #18 (https://exiftool.org/faq.html#Q18) is the relevant FAQ since you're on Windows.  The problem is Windows command lines don't handle different character encoding well.  Try the options in that FAQ and see if that helps.

Another thing to try is this StackOverflow answer (https://stackoverflow.com/questions/57131654/using-utf-8-encoding-chcp-65001-in-command-prompt-windows-powershell-window/57134096#57134096), but that route can have side effects on the fonts in older programs which may mess up some GUIs.

But with regards to &#39;, that shouldn't be a problem as that is just the single quote encoded as an XML entity.  See Predefined entities in XML Wikipedia page (https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML). Any program that correctly reads XML should read that correctly.
Title: Re: Command-line - Windows : fight against character encoding problem or accept it?
Post by: sylf on December 12, 2021, 11:43:49 AM
Thank you, I will try.
S