Do I need to set IPTC:codedCharacterSet manually

Started by Mac2, April 04, 2012, 09:18:14 AM

Previous topic - Next topic

Mac2

When I write IPTC data to a file I sometimes need to explicitly set utf8 encoding via:

charset iptc=utf8

But it seems that the iptc:codedCharacterSet is not added/set automatically when I do this. I have to explicitly add a

iptc:codedCharacterSet=utf8

Is this how it's supposed to work or do I miss something?

Phil Harvey

This is how it is supposed to work.  If you specify -iptc:codedCharacterSet=utf8 then you don't need the -charset iptc=utf8.

Writing CodedCharacterSet is not automatic because it may affect the encoding of existing IPTC.

- 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 ($).

Mac2

Hi, Phil

so when I use -charset iptc=utf8  I just tell ExifTool which character set I use for the strings I'm handing over.

ExifTool still checks the character set in the file and does the conversion? Because if the file is Latin 1 I could otherwise create a mix of UTF8 and Latin 1 characters in the file.

If I would like to switch all IPTC contents to UTF8 I would first need to run one of the commands you mention in FAQ #10 to convert the existing data, and then set the codedCharacterSet=UTF8.

Phil Harvey

Not quite.

This is explained in FAQ 10, but I see how it could be confusing.  I have tweaked the FAQ to try to make this a bit more clear.

The -charset iptc=CHARSET option specifies the internal encoding used in the IPTC, and only has an effect if there is no CodedCharacterSet specified.

The commands given in FAQ 10 may convert the IPTC to UTF-8 internally and write the CodedCharacterSet at the same time.  After this, you can write happily without having to worry about the internal IPTC encoding.  Then, you only need to worry about the encoding of the new values that you pass to exiftool, and for these the -charset exiftool=CHARSET must be set accordingly.

- 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 ($).

Mac2