Country Codes in IPTC data - bug?

Started by sauron, June 20, 2012, 07:56:11 PM

Previous topic - Next topic

sauron

Hi,

I've been attempting to update IPTC data using Exiftool, and I get the following error from my code:-


String too short (minlen is 3) for IPTC:Country-PrimaryLocationCode


When I look at the Exiftool docs, it's pretty clear that this requires an ISO-3166 3 character country code, and the problem is occurring because I attempted to insert a 2 character code. All that makes sense, but the latest version of the IPTC spec here https://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata-201007_1.pdf claims on page 46 that 2 character codes should be acceptable:-


NameCountry ISO-Code {location detail}
DefinitionThe ISO code of a country of a location. This element is at the second level of a top-down geographical hierarchy.
Photo DefinitionThe ISO code of a country of a location. This element is at the second level of a top-down geographical hierarchy.
Photo Help TextEnter the 2 or 3 letter ISO 3166 Country Code of the Country
User Note(s)
Implementation Note(s)
Field label/title(Location detail:) Country ISO-Code
Cardinality0..1Basic data typeCV-code
Required CVISO 3166-1 - 2 or 3 characters (see Definition)
Spec change historySpecs (201007): XMP ValueType corrected

I can obviously fix my code by making it conform to ISO-3166 3 character codes, but it seems that Exiftool should allow setting of either 2 or 3 character country codes.

Mike

Phil Harvey

Hi Mike,

The specification you refer to is the new IPTC Core, which uses XMP and not IPTC IIM format.  I suggest writing the XMP version (XMP:CountryCode).  The old IPTC IIM spec hasn't changed as far as I know.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).