Project

General

Profile

IPTC tags with special characters such as &, ø, ë, etc...

Added by Mark Ijsseldijk almost 5 years ago

I generate IPTC tags using an Excel spreadsheet and in general the EXIV2 works flawlessly and tags thousands of images in a matter of minutes. I have a couple of issues though:

If a tag contains the "&" symbol then the tag is not written at all. Example below:
exiv2 -M"set Iptc.Application2.CountryName String \"Trinidad & Tobago\"" 14G0003.jpg

If a tag contains a special character such as ø, ç, ä, etc then this letter in the tag is substituted.
exiv2 -M"set Iptc.Application2.City String \"Aückland - Internatiønal\" " 14G0003.jpg

Tag is recorded as: "A³ckland - Internati°nal"

I have found the workaround of entering \u00fc instead of the ü and \0f8 instead of the ø but is there any other option in insert these characters automatically.

Thanks

Mark


Replies (3)

RE: IPTC tags with special characters such as &, ø, ë, etc... - Added by Robin Mills almost 5 years ago

You can change the character set encoding on the command line. Search for charset here: http://www.exiv2.org/manpage.html

Are you generating those commands and executing them in Windows? This question is really about how to format command-line arguments correctly in your environment. I suggest a two step approach:

1 Discover the correct command-line arguments (including the charset) that give you the result you desire.
Keep out of Excel. Work in cmd.exe and find the correct command arguments.

2 Discover how to generate the correct command in your environment.
I have a little program args.cpp which I have found very useful for discovering exactly what's on the command line. I've discussed it here: http://dev.exiv2.org/boards/3/topics/2066?r=2067#message-2067

RE: IPTC tags with special characters such as &, ø, ë, etc... - Added by Robin Mills almost 5 years ago

Out of curiosity, I tried this on both Mac (bash shell) and Windows/7 cmd.exe.

Mac:

601 rmills@rmillsmbp:~/temp $ exiv2 -pa --grep Caption Stonehenge.jpg 
Iptc.Application2.Caption                    String     12  Classic View
602 rmills@rmillsmbp:~/temp $ exiv2 -M"set Iptc.Application2.Caption IPTC tags with special characters such as &, ø, ë, etc..." Stonehenge.jpg 
603 rmills@rmillsmbp:~/temp $ exiv2 -pa --grep Caption Stonehenge.jpg 
Iptc.Application2.Caption                    String     59  IPTC tags with special characters such as &, ø, ë, etc...
604 rmills@rmillsmbp:~/temp $ 
Windows:
C:\cygwin64\home\rmills\gnu\exiv2\trunk\msvc2005\bin\win32\releasedll>exiv2 -pa --grep Caption Stonehenge.jpg
Iptc.Application2.Caption                    String     12  Classic View

C:\cygwin64\home\rmills\gnu\exiv2\trunk\msvc2005\bin\win32\releasedll>exiv2 -M"set Iptc.Application2.Caption IPTC tags with special characters such as &, ø, ë, etc..." Stonehenge.jpg

C:\cygwin64\home\rmills\gnu\exiv2\trunk\msvc2005\bin\win32\releasedll>exiv2 -pa --grep Caption Stonehenge.jpg
Iptc.Application2.Caption                    String     57  IPTC tags with special characters such as &, °, δ, etc...

C:\cygwin64\home\rmills\gnu\exiv2\trunk\msvc2005\bin\win32\releasedll>

As you can see, the Mac has dealt with this effortlessly. Windows was been challenged. Theres something in Windows called "The Code Page". I found this with Google: http://www-01.ibm.com/support/docview.wss?uid=swg21562473 When I set the code pages to 1252 (ANSI), everything's fine.

C:\cygwin64\home\rmills\gnu\exiv2\trunk\msvc2005\bin\win32\releasedll>CHCP 1252
Active code page: 1252

C:\cygwin64\home\rmills\gnu\exiv2\trunk\msvc2005\bin\win32\releasedll>exiv2 -pa --grep Caption Stonehenge.jpg
Iptc.Application2.Caption                    String     57  IPTC tags with special characters such as &, ø, ë, etc...

C:\cygwin64\home\rmills\gnu\exiv2\trunk\msvc2005\bin\win32\releasedll>
Being a native English speaker, I find localisation a strange land.

RE: IPTC tags with special characters such as &, ø, ë, etc... - Added by Mark Ijsseldijk 5 months ago

Sorry to re-activate such an old post but I am still encountering issues with the way tags are being read in other software.

I note on the reply above about the character set encoding on the command line. I cannot find any examples on this so if anyone can advise how to incorporate this in the below command line, that will be appreciated:

exiv2 -M"set Iptc.Application2.Caption String \"F-OJSE     Airbus A330-202     510          AirCalin - Air Calédonie International\"" D:\Temp\20B0004.jpg
exiv2 -M"set Iptc.Application2.Caption String \"PR-RDD     Gulfstream G550      5280      Yamandu Empreendimentos e Participações SA\"" D:\Temp\20B0037.jpg

I have used a workaround as below but this is now also causing issues.

exiv2 -M"set Iptc.Application2.Caption String \"F-OJSE     Airbus A330-202     510          AirCalin - Air Cal\u00E9donie International\"" D:\Temp\20B0004.jpg
exiv2 -M"set Iptc.Application2.Caption String \"PR-RDD     Gulfstream G550      5280      Yamandu Empreendimentos e Participa\u00E7\u00F5es SA\"" D:\Temp\20B0037.jpg

Using exiftool, I can specify the character set as Latin as in below, and this allows the special character to be correctly written and subsequently displayed:

exiftool -charset latin

I'd prefer to used EXIV2 as I have lots of automation setup for this.

Thanks as always

    (1-3/3)