Escape double quotes in mapfiles/mapscript?

Andreas Albarello andreas.albarello at TERRITORIUMONLINE.COM
Sat May 13 09:25:24 EDT 2006


Mike Leahy wrote:
> I'm wondering if there is currently any way to escape double quotes in 
> mapfile properties.  As an example, I want to be able to use a query on 
> a PostGIS table as the data source for a layer, where columns' aliases 
> have double quotes around them, as is normally done in PostgreSQL when 
> spaces or other characters are involved (e.g., the following would crash 
> MapServer 4.8:

Mike,

as Tamas already pointed out by listing a couple of bugs filed about
this issue, there's currently no way to do so. You simply can't have the
same character you use as delimiter for a certain string (which for
Mapserver is either a double quote or a single quote) inside that string.

> DATA "the_geom from (select id as \"Field ID\", the_geom from sometable) 
> as foo using unique \"Field ID\" using srid 5326;"

You should however be able to address this particular issue by putting
single quotes instead of double quotes around your DATA definition. This
should make it possible to use double quotes inside. The same applies
vice versa, of course, as long as you don't need to use both types of
quotes inside the same string, which is not possible at all.

Best regards,
-- 
--------------------------------------------------------------------
Andreas Albarello
Analysis & SW Development

Territorium Online srl/GmbH
Via Buozzi/Buozzistraße 12 - I 39100 Bolzano/Bozen
email: andreas.albarello at territoriumonline.com
web:   www.territoriumonline.com
--------------------------------------------------------------------



More information about the mapserver-users mailing list