how to write escaped unicode

Started by mipa, February 17, 2020, 12:12:25 AM

Previous topic - Next topic

mipa

Hi,

first thanks for the great piece of software.

I'm working on a (cross-os: win, mac, linux) program which is currently executing the exiftool binary as external application to read/write exif/iptc/xmp data.
I was using a different extern software (exiv2) so far which is not as portable as exiftool so I want to replace that.

For the other tool I was able to solve the utf8 mess of different os systems by using escaped unicode
-M set Xmp.dc.description "this is a test \u00f6\u00f6\u00f6 description"

but when I do it with exiftool
-xmp:Description="this is a test \u00f6\u00f6\u00f6 description"
I get exactly that string set
Description: this is a test \u00f6\u00f6\u00f6 Description


I also tried the html way
-h -xmp:Description="this is a test &#00f6;&#00f6;&#00f6; Description"
but ended up with exactly that string written
Description: this is a test &#00f6;&#00f6;&#00f6; Description


Any hints how I can write encoded unicode characters?

Since it needs to run on windows and non-windows systems I don't want to risk breaking things by playing around with different charsets - which I couldn't get to work on my windows either with umlauts.

StarGeek

Use the -E (escapeHTML) option.  You also need an x to indicate hex.

C:\>exiftool -P -overwrite_original -E -xmp:Description="this is a test ööö Description" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -g1 -a -s -description y:\!temp\Test4.jpg  -L
---- XMP-dc ----
Description                     : this is a test ööö Description


Or decimal version
C:\>exiftool -P -overwrite_original -E -xmp:Description="this is a test ööö Description" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -g1 -a -s -description y:\!temp\Test4.jpg  -L
---- XMP-dc ----
Description                     : this is a test ööö Description


Another option would be writing to a temp .txt file and using the -TAG<=DATFILE option
C:\>echo >temp.txt this is a test ööö Description

C:\>type temp.txt
this is a test ööö Description

C:\>exiftool -P -overwrite_original -xmp:Description<=temp.txt y:\!temp\Test4.jpg -L
Description                     : this is a test ööö Description
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

mipa

works perfect with the -E option and &#x00f6;

thanks a lot  :)