Is there anyway to escape strings consistently in Google Earth kml files? -
when creating kml content google earth, noticed discrepancy in how tries escape characters prevent javascript code execution. if characters inside <name></name>
tags escaped twice html character codes e.g. "<script></script>
" &#60;script&#62;&#60;/script&#62;
display correctly <script></script>
in side bar, in label placemarker, display <script></script>
. preferable text escaped display same in both places.
examples files , google earth representations have been added post.
the first image shows string has been unescaped , can see in sidebar cuts off text in tag displays entire tag correctly in main window. can see javascript in tag has been executed in window. attached file unescaped.kml file opened in screen shot.
kml file used:
<?xml version="1.0" encoding="utf-8"?> <!--the name of placemark escaped on label of pushpin not in sidebar (does not validate kml validator)--> <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2"> <placemark> <name><script>document.write("test")</script> text</name> <description>text</description> <point> <coordinates>10,10,0 </coordinates> </point> </placemark> </kml>
the second image shows same string escaped avoid javascript execution, not parse html character codes correctly on placemark label in main window. attached file escaped.kml file opened in screen shot.
kml file used:
<?xml version="1.0" encoding="utf-8"?> <!--the name of placemark escaped on label of pushpin not in sidebar (does not validate kml validator)--> <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2"> <placemark> <name>&#60;script&#62;document.write("test")&#60;/script&#62; text</name> <description>text</description> <point> <coordinates>10,10,0 </coordinates> </point> </placemark> </kml>
is there workaround correctly escapes text , correctly escapes strings , displays them correctly or bug in google earth have deal with?
Comments
Post a Comment