Charset conversion not working with -n option

Started by mstorhas, September 11, 2012, 07:05:31 AM

Previous topic - Next topic

mstorhas

Hello Phil,

I'm using the CodedCharacterSet tag to convert IPTC content from Latin to UTF-8 for our customer, and it works well so far, e.g.
exiftool -charset Latin -iptc:Caption-Abstract="#äöü ÄÖÜ ß@€# #!§$%&/()=?#" -iptc:codedcharacterset="utf8" -o dest.jpg orig.jpg
However, when at the same time print conversion is disabled (I specify resolution units in numbers) using the -n option, IPTC content will still be Latin in the output file, example:
exiftool -charset Latin -iptc:Caption-Abstract="#äöü ÄÖÜ ß@€# #!§$%&/()=?#" -iptc:codedcharacterset="utf8" -JFIF:ResolutionUnit=1 -o dest.jpg -n orig.jpg
Instead of utf8 I also tried "ESC % G" for CodedCharacterSet, but it didn't work either. I could relatively easy get around this by adding # to my resolution unit tags and removing the -n option, but I wanted to report this behaviour nevertheless.
I'm using command line on windows xp and tried version 9.02.

Greetings, Martin

Phil Harvey

Hi Martin,

The problem is that you must specify the binary escape sequence for CodedCharacterSet when -n is used (the same for reading or writing):

> exiftool a.jpg -codedcharacterset=utf8
    1 image files updated

> exiftool a.jpg -codedcharacterset
Coded Character Set             : UTF8

> exiftool a.jpg -codedcharacterset -n
Coded Character Set             : .%G

> exiftool a.jpg -codedcharacterset -b | hexdump -
    0000: 1b 25 47                                        [.%G]


This may seem odd, but it allows full control over the escape sequence if necessary.

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