Project

General

Profile

XMP and ü ä

Added by Peter Müller almost 10 years ago

Hi,
I use the tool exiv2 0.2 on Win 7 64bit.
As far as everything works, except for one small thing.

I work mainly with the two calls
Set Xmp.dc.subject
add Iptc.Application2.Keywords

If I xmp data with ü, ä, etc. want to write it does not work.
In contrast, iptc it works.

The call is:
exiv2-M "set Xmp.dc.subject Müller" C: \ test \ test.jpg

The following error message appears
Error: XMP toolkit error 4: Invalid UTF-8 sequence length
Error: Failed to encode XMP metadata.

Is there a trick as I get it anyway?

Is there a way to remove some keywords? (eg, remove 1 of 3)
Is there a way to rename a label?
Is there a way to prevent that a keyword can be entered more than once?

Best regards
Peter

PS: I hope you know what I mean. I am German.


Replies (3)

RE: XMP and ü ä - Added by Andreas Huggel almost 10 years ago

The XMP value must be in UTF-8 but Exiv2 doesn't translate the input. (A missing feature, which affects mostly Windows users nowadays.)
If your Terminal uses UTF-8, you won't have that problem, else it is an issue. As a workaround you can use the notation \uXXXX to pass the correct unicode value to Exiv2.
The example below demonstrates 1) how everything is ok on my UTF-8 terminal and 2) the use of \u00fc for ü. (Note that even if you use \u to set the correct value, your terminal output will probably not look right because the value is also not translated back to the terminal's character encoding.)

$ exiv2 -M"set Xmp.dc.subject Müller" image.jpg 
$ exiv2 -pa image.jpg 
Xmp.dc.subject                               XmpBag      1  Müller
$ exiv2 -M"set Xmp.dc.subject M\u00fcller" image.jpg 
$ exiv2 -pa image.jpg 
Xmp.dc.subject                               XmpBag      2  Müller, Müller

As for the questions about array values, there is no support to access individual elements (e.g., the second keyword) from the Exiv2 command line tool. You'll have to delete all and re-set them.

Andreas

RE: XMP and ü ä - Added by Peter Müller almost 10 years ago

Thanks Andreas,
I have tested version 2 and it works great.

Thanks for the good support

RE: XMP and ü ä - Added by Steve Wright almost 10 years ago

I have noticed this phenomenon, which seems to me to be related.

If you have a command file in ISO-1659-1, and you happen to include characters with accents or diacriticals in it, you'll get the same error Peter described in his OP. While if you save the same file as UTF-8 (in Crimson Editor for Windows, I use the 'w/o BOM' selection in the Document>Encoding Type pulldown menu; in Linux I just use Geany or nano), this error does not occur. I suppose it's because the hex code for any and all accented or otherwise "special" characters are written into the file itself, which is easier for Exiv2 to handle.

SJ Wright

    (1-3/3)