base64 on iptc:Headline

Started by Zenta, May 09, 2012, 04:03:47 AM

Previous topic - Next topic

Zenta

Hi Phil

We have a problem with updating metadata i would like to ask you about.

If i write "Hej mitt namn ar Bennie" to -iptc:Headline i get the input "Hej mitt namn ar Bennie" in the XML data. I like that

The problem is if i use a swedish letter like ä example: "Hej mitt namn är Bennie" then i get a base64 encoded string instead.

Without ä <IPTC:Headline>Hej mitt namn ar Bennie</IPTC:Headline>

With ä <IPTC:Headline rdf:datatype='http://www.w3.org/2001/XMLSchema#base64Binary'>aGVqIGhvcHBu5HJnZXIgc25vcHA=</IPTC:Headline>

we do not want exiftool to make it a base64. How can we do that and why is it base64 encoded?

Phil Harvey

This works for me here (ExifTool 8.91, Mac OS X):

> exiftool a.jpg -iptc:headline='Hej mitt namn är Bennie'
    1 image files updated

> exiftool a.jpg -iptc:headline -X
<?xml version='1.0' encoding='UTF-8'?>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

<rdf:Description rdf:about='a.jpg'
  xmlns:et='http://ns.exiftool.ca/1.0/' et:toolkit='Image::ExifTool 8.91'
  xmlns:IPTC='http://ns.exiftool.ca/IPTC/IPTC/1.0/'>
<IPTC:Headline>Hej mitt namn är Bennie</IPTC:Headline>
</rdf:Description>
</rdf:RDF>


What version of ExifTool are you using?  Also, it may help you you post your exact command line and a small test image that illustrates the problem.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Zenta

We are using 8.7.7 but i just tired and its the same with the latest function.

"c:\temp\image.jpg" -iptc:Headline="Hej mitt namn är Bennie"

This is the command that is runed, the only differens is that we have built a software that gets the string from a mssql db. Something like this:

-iptc:Headline="<mssql default="{iptc:Headline}" connection="server=192.168.81.248\MSSQL;uid=sa;pwd=**********;database=******;pooling=false" command="SELECT Head from [MyDb] Where userid = {iptc:Credit} " />"

The <mssql> tag is replaced by its returning value that is "Hej mitt namn är Bennie".

Phil Harvey

I'm guessing that your string isn't valid UTF-8.  ExifTool will encode in base64 if the value isn't valid UTF-8.  You should carefully check the encoding of the strings from your mssql db.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

I was right.  I unpacked the base64 you posted, and the character "ä" is encoded as E4 hexadecimal, which is not UTF-8.  It should be encoded as C3 A4.

This may happen if the IPTC encoding is incorrect, which is a common problem with IPTC.  See FAQ number 10 for some help with coded character sets.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Zenta

We tried that but solved the problem running HTML encoding as you recommended in another post.

Thank you for your help again phil. U the m(E4 hexadecimal)n!