Treatment of special (HTML or XML) characters

Started by Archive, May 12, 2010, 08:54:39 AM

Previous topic - Next topic

Archive

[Originally posted by runningwolf on 2009-07-26 15:45:13-07]

Hello,

I am pretty sure this has been asked before but I can't find it.
Within my exif descriptions I sometimes use the "&" symbol (e.g. Karl & Willy). When generating a kml file with that being extracted (to see the text in Google Earth) I receive the message "parse error at line nnn column nnn: not well-formed (invalid token).
I tried the -E option but no change.

Any hint?

Thx a lot!!

Archive

[Originally posted by exiftool on 2009-07-26 20:25:08-07]

The -E should convert the & to &.  It does this
from the command line.  Exactly how are you generating the
KML file?

 - Phil

Archive

[Originally posted by exiftool on 2009-07-26 20:43:25-07]

Ah, right.  -E doesn't work with -p.  I'll have to
think about this.  The -E is implemented by the exiftool
application, but to do this it would have to be
implemented at a lower level (by the ExifTool library)
because you don't want to escape special characters outside
the tag values.  I'll put this on my list, but it will
have to wait until I get back from vacation.

- Phil

Archive

[Originally posted by runningwolf on 2009-07-27 08:10:47-07]

Hi Phil,

Thanks a lot for looking at this, particularly during your time off.
I use exiftool with these command line parms: -E -L -f -n -r -q -p kml-placemark.fmt

Enjoy!!

Archive

[Originally posted by runningwolf on 2009-08-10 05:31:34-07]

Any news on this?

Archive

[Originally posted by exiftool on 2009-08-11 11:38:53-07]

I'm back now and as soon as I get a chance I will look into moving
the -E implementation  out of the application and into the
library so it will work when combined with the other options.

Look for this new feature in the next release in about a week or so
if all goes well.

 -Phil

Archive

[Originally posted by runningwolf on 2009-08-21 13:22:09-07]

Hi Phil,

tried it but GE keeps showing an error message. Now it seems to be related to German "umlaut". GE says undefined entity. If I remove the "umlaut" it works OK, also with an ampersant in the text.

Archive

[Originally posted by exiftool on 2009-08-21 14:35:09-07]

I don't know the structure of your KML file, but the KML format is based on XML
so HTML character entities will only be allowed within a CDATA block.  I tried
the following Placemark and it works for me:

Code:
<Placemark>
    <description><![CDATA[
<table><tr><td>Comment</td><td>test &uuml; thing</td></tr></table>]]></description>
    <Snippet/>
    <name>IMGP2763_JFR.jpg</name>
    <styleUrl>#Photo</styleUrl>
    <Point>
        <altitudeMode>clampedToGround</altitudeMode>
        <coordinates>-75.6224358416694,35.23197625865,10.92272379</coordinates>
    </Point>
</Placemark>

- Phil

Archive

[Originally posted by exiftool on 2009-08-21 14:50:18-07]

It sounds like you need an XML rather than HTML escape
option, which the exiftool application currently doesn't have,
so I am hoping that something like the above will allow
you to get around the problem.

 - Phil

Archive

[Originally posted by runningwolf on 2009-08-24 06:54:59-07]

Hi Phil,

Thanks for your investigation.
Here's my template. Too me it looks OK.
To clarify, German "Umlaut" worked fine in the previous release....

Merci beaucoup!
Code:
<Placemark>
   <description><![CDATA[
<table><tr><td>
   <img src='$directory\$filename' width='$imagewidth' height='$imageheight'>
   </td></tr></table>]]></description>
   <Snippet/>
   <name>$filename, $ImageDescription, $usercomment</name>
   <styleUrl>#Photo</styleUrl>
   <Point>
      <altitudeMode>clampedToGround</altitudeMode>
      <coordinates>$gpslongitude,$gpslatitude,0</coordinates>
   </Point>
</Placemark>

Archive

[Originally posted by exiftool on 2009-08-24 11:39:25-07]

I think the -ex option that I added to exiftool
7.90 (now available) should solve your problem.  Use this
instead of -E.

- Phil

Archive

[Originally posted by runningwolf on 2009-08-24 12:51:47-07]

It really does :-)

Thanks very much!!!