Search code examples
javascriptopenlayersquotes

is there an additional quotation mark in javascript?


in openlayers I am reading a kml string that has dynamically created from oracle with the Perl DBI. I read the kml like this.

function GetFeaturesFromKMLString (strKML) {
    var format = new OpenLayers.Format.KML({
    'internalProjection': new OpenLayers.Projection("EPSG:900913"),
    'extranalProjection': new OpenLayers.Projection("EPSG:4326")    
    });
    return format.read(strKML);
};

vector_Layer.addFeatures(GetFeaturesFromKMLString('$newkml'));

Unfortunately I've found some fields in my database that contain an apostrophe so the quotation mark stops working. There are also " in the kml. In perl I'd use the qq thing but I don't think that works in JavaScript. So my question is: is there another way of quoting in JavaScript?


Solution

  • No need to add any \

    http://www.w3schools.com/tags/ref_urlencode.asp

    In javascript there is a function that does it for you, it is possible that you need to decode it when using it

    Hope this helps