ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: aussenboarder on November 11, 2012, 06:12:54 AM

Title: How to rewrite IPTC keywords using UTF-8 encoding?
Post by: aussenboarder on November 11, 2012, 06:12:54 AM
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 (http://newsgroup.xnview.com/viewtopic.php?f=62&t=27042).

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
Title: Re: How to rewrite IPTC keywords using UTF-8 encoding?
Post by: Phil Harvey on November 11, 2012, 07:54:06 AM
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