apostrophes and quotes inside dbf

Andreas Albarello andreas.albarello at TERRITORIUMONLINE.COM
Mon Aug 8 03:40:26 EDT 2005

Sorry for reposting this one to all those subscribed to the mapserver 
user list as well, but as I haven't yet got any feedback there I thought 
it might be better to directly talk to the developers.

What I was pointing at was that dbf-records containing apostrophes or 
quotes in one of their fields don't show up in an attribute query result 
set when such a field is referenced inside the expression.

For instance, a query like

'[ORT_NAME_I]' =~ /.*(A|a)(N|n)(D|d)(R|r).*/

produces the expected results except for the record where ORT_NAME_I is 
Sant'Andrea, which doesn't show up due to the apostrophe (things behave 
exactly the same on other dbf-data, using different queries and working 
on different machines, when there's char #34 or #39 around).

I guess that things go wrong somewhere inside the parser which is called
from msEvalExpression. In fact, what the parser would probably need to 
do is to escape any quote and apostrophe in a string expression as 
things are ok when I surround [ORT_NAME_I] in the example above with 
quotes instead of apostrophes, but that vice versa hides any record 
containing a quote.

Is this a bug or am I overlooking anything?

Best regards,
Andreas Albarello
Territorium Online Srl/GmbH
andreas.albarello at territoriumonline.com

More information about the mapserver-dev mailing list