[gdal-dev] Re: WFS and -where with non-ASCII characters

Mateusz Łoskot mateusz at loskot.net
Tue Jan 3 07:45:15 EST 2012

On 3 January 2012 11:07, Jukka Rahkonen <jukka.rahkonen at mmmtike.fi> wrote:
> I took the successful query sent by Ari from the TinyOWS log and copied it
> literally into Windows and this way it works:
> -where name='Hämeenkylä'

Windows Command Prompt can work with UTF-8 characters if you change
codepage to UTF-8:

0) Open new prompt (cmd.exe)
1) Change font to Lucida Concole
3) chcp 65001

And OGR can consume filter without problems:

-where "name=\"Hämeenkylä\""

Note, the \"\" is needed to not to confuse OGR SQL compilers,
otherwise value Hämeenkylä
will be parsed as OGR SQL type SNT_COLUMN instead of SNT_CONSTANT for
field value.

However, I think the problem may be with TinyOWS. It throws error;

<ows:ExceptionText>QUERY_STRING contains forbidden

which is generated by TinyOWS:


where TinyOWS simply tests characters passed in request against fixed
range: A-Za-zà-ÿ
Comparing extended ASII codes, the value 'ä' is outside of this range anyway.

I get no WFS exception no OGR error when querying with some (not all)
Polish diacritics:

ogrinfo WFS:http://hip.latuviitta.org/cgi-bin/tinyows
lv:pks_tilastoalue_piste -where "name=\"ąęśćł\""

Certainly, it gives empty resultset.

I think it would be a good idea to try against different WFS server.

Best regards,
Mateusz Loskot, http://mateusz.loskot.net

More information about the gdal-dev mailing list