metadata-extractor icon indicating copy to clipboard operation
metadata-extractor copied to clipboard

Treat \0 as terminator in IPTC strings

Open jamesgorrie opened this issue 8 years ago • 1 comments

The below image, when passed through exiftool, reads the IPTC Source as "Getty Images North America".

When read with the IptcDirectory we're getting "Getty Images ����". On closer inspection it looks something more like: "Getty Images\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0003\u0000\u0000\u0000\u0005\u0000\u0000\u0000\n����".

The null character is often used to denote the end of a string - is this being respected? Or not as it's not part of the standard?

getty-borked

jamesgorrie avatar Sep 04 '15 10:09 jamesgorrie

From looking at the file in a hex editor, it seems that the Getty Images North America string only exists in an IPTC segment and is extracted successfully:

[IPTC - 0x0273] Source = Getty Images North America

What's interesting in this file is that there are actually two IPTC segments. At a glance it seems that the segment with the target string exists within Photoshop data.

It's reasonable that the string you're referring to should treat the first null character as a terminator.

drewnoakes avatar Nov 25 '15 01:11 drewnoakes