[gdal-dev] how to escape special charakter

Frank Warmerdam warmerdam at pobox.com
Tue Feb 9 10:39:49 EST 2010


Suhr, Ralf wrote:
> Hello list,
> 
>  
> 
> how can I write the commandline to work on a dos box. The dos box says: 
> program „name“ is not found. On linux it run fine.
> 
>  
> 
> ogr2ogr -f "DGN" -sql "SELECT 'LABEL(f:\"Times New Roman\",s:12pt,t:\"' 
> || name || '\")' AS OGR_STYLE,  *  FROM mytable" export.dgn 
> „PG:dbname=..--..“

Ralf,

The problem, I believe, is that the DOS command parser does not understand
backslash escaping to protect the internal double quotes.  I don't really
know if the above can be processed properly by the DOS command parser.

One option might be to install Cygwin which provides a unix-like shell
interpreter (bash) that should follow normal unix rules.

Alternatively, you could possibly invoke os.execl() in python to invoke
a subproject with preparsed arguments.

I had wanted to suggest using the GDAL/OGR --optfile switch which allows
reading command options from a text file, but on review I think the
escaped quotes will also end up confusing it and you will be no better off.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list