[gdal-dev] WFS driver does not do URL-encoding right

Even Rouault even.rouault at mines-paris.org
Wed Aug 15 14:24:34 PDT 2012


Le mercredi 15 août 2012 23:14:53, Rahkonen Jukka a écrit :
> Even Rouault wrote:
> 
> Le mercredi 15 août 2012 21:28:22, Jukka Rahkonen a écrit :
> >> GvSIG is also sending GetFeatures with http GET and filters and it had
> >> same kind of problems with special characters. Now the developers say
> >> that they have fixed URL encoding. I hope that the solution is somehow
> >> re-usable
> > 
> > I'm not sure this is a problem with URL encoding, but more a problem with
> > the fact that the Windows console is not using UTF-8. So even if the OGR
> > WFS driver did escape the special character, this wouldn't solve
> > anything, since it would get a non UTF8 character and would escape it
> > wrongly...
> > 
> > Some seraching would suggest that typing "chcp 65001" before might help,
> > but I'm not sure...
> > 
> > I'm wondering if the GDAL command line utilities shouldn't use special
> > instructions under Windows to better deal with Unicode characters. Some
> > search would suggest that using wmain() and/or SetConsoleOutputCP()
> > might help. Are there Windows programmers around that might give advice
> > on how to get arguments in UTF-8 from the Windows command line ?
> 
> > Anyway, with Linux, it works fine :
> ........
> 
> If it happens to help, this is the only reliable method I have discovered
> so far for creating GetFeatures on Windows so that they work.
> 
> 1) Create a complete plain text request
> 2) Split it into two pieces and copy the part before XML filter to a safe
> place.
> http://188.64.1.61/cgi-bin/tinyows?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFe
> ature&TYPENAME=lv:municipalities&FILTER= 3) Copy the filter part and drop
> into some URL encoding service like
> http://www.albionresearch.com/misc/urlencode.php.

Looks a bit complicated. Actually, I'm thinking you could avoid those encoding 
problems with using :

ogrinfo "WFS:http://188.64.1.61/cgi-bin/tinyows" -sql --optfile sql.txt

where sql.txt contains (with a UTF-8 text editor, such as Notepad++ correctly 
configured) :

"select * from municipalities where kunta_ni1='Saarijärvi'"

(The double-quote at the beginning and trailing of the file are necessary)


More information about the gdal-dev mailing list