[Geoserver-devel] [JIRA] (GEOS-7385) Honour default charset when parsing WFS KVP Filter

Ben Caradoc-Davies [Administrator] created an issue

GeoServer / BugGEOS-7385

Honour default charset when parsing WFS KVP Filter

Issue Type:

BugBug

Affects Versions:

2.9-beta

Assignee:

Ben Caradoc-Davies [Administrator]

Components:

WFS

Created:

23/Jan/16 12:26 AM

Environment:

Java 8

Priority:

MediumMedium

Reporter:

Ben Caradoc-Davies [Administrator]

The WFS KVP Filter parser fails to set an encoding for its SAX InputSource. On non UTF-8 platforms (not using -Dfile.encoding=UTF-8), this results in a mismatch between the platform encoding and an assumed UTF-8 encoding and consequently a MalformedByteSequenceException when a Filter contains a non-ASCII character, even when that character is correctly percent-encoded as UTF-8 octets in the request.

The reported exception can be reproduced on a UTF-8 platform by starting GeoServer with -Dfile.encoding=ISO-8859-15 and visiting this link:

http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=topp:states&filter=%3Cfes:Filter%20xmlns:fes=%22http://www.opengis.net/fes/2.0%22%3E%3Cfes:PropertyIsLike%20wildCard=%22*%22%20singleChar=%22%25%22%20escapeChar=%22!%22%3E%3Cfes:ValueReference%3Etopp:STATE_NAME%3C/fes:ValueReference%3E%3Cfes:Literal%3E%C3%BC*%3C/fes:Literal%3E%3C/fes:PropertyIsLike%3E%3C/fes:Filter%3E

%C3%BC is a percent-encoded “ü”.

Workaround is to start GeoServer with: -Dfile.encoding=UTF-8

-------- Forwarded Message --------
Subject: Re: [Geoserver-users] Exception with Filter 2.0 and matchCase=“false” on PropertyIsLike
Date: Fri, 22 Jan 2016 10:04:12 +0100
From: Nhan Vo
To: Ben Caradoc-Davies
CC: geoserver-users@anonymised.comsourceforge.net

Hi Ben,

Thanks again for the response. Under my Geoserver’s
Settings/Global/Character Set the value is UTF-8 but I still I had the
parsing problem with “Ü”. Then I restart my server adding
-Dfile.encoding=UTF-8 to Java options the problem goes away. Perhaps
somewhere in the code the Parser was constructed without explicitly
specifying an encoding. I post the stack trace here just in case it
could help locate the culprit.

Unable to parse filter: <fes:Filter
xmlns:fes=“http://www.opengis.net/fes/2.0”><fes:PropertyIsLike
wildCard="" singleChar=“#”
escapeChar=“!”><fes:ValueReference>topp:STATE_NAME</fes:ValueReference><fes:Literal>�?
</fes:Literal></fes:PropertyIsLike></fes:Filter>
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException:
Ung�ltiges Byte 2 von 2-Byte-UTF-8-Sequenz.
at
com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:701)
[…]
org.geoserver.wfs.kvp.FilterKvpParser.parse(FilterKvpParser.java:84)
[…]

Add Comment

Add Comment

This message was sent by Atlassian JIRA (v7.1.0-OD-05-006#71001-sha1:081cc1a)

Atlassian logo