How to rewrite IPTC keywords using UTF-8 encoding?

Started by aussenboarder, November 11, 2012, 06:12:54 AM

Previous topic - Next topic

aussenboarder

I have a bunch of image files in multiple folders which have IPTC keywords applied to them. There are image files with one or more keywords.
By accident I wrote those keywords using non-UTF-8 encoding running Windows 7. When I inspect the keywords running Ubuntu, I notice that special characters such as ß do not show up. Here is the original question in the XnView forum.

How can I detect image files which have their keywords set other then UTF-8 and rewrite those with the desired encoding? This should work on multiple files and folders.

Best, aussenboarder

Phil Harvey

Hi Aussenboarder,

Detecting improperly encoded IPTC is tricky.  If there are some specific characters that would only exist in improperly formatted IPTC you could search for these.  For example, if you know that "ü" shouldn't exist, then you could do this:

exiftool -if "$keywords =~ /[ü]/" ...

to process only files with keywords containing this character.  You can add as many characters as you want inside the square brackets in this expression.

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