I have a shapefile loaded in GeoServer 2.8 and accessed by OpenLayers 2.13. This layer is in UTF-8 encoding and has some english and non-english records.
When i use english fields in cql-filter - as follows, but no differnce between WMS and WFS request- GeoServer filters data very well and returns the result.
layer1 = new ol.layer.Image({
title: 'Ostan',
source: new ol.source.ImageWMS({
url: 'http://localhost:8080/geoserver/wms',
params: {
LAYERS: 'ws:layer1',
VERSION: '1.1.1',
CQL_FILTER: "NAME_ENG = 'sommy'"
}
})
});
But if i try to use a field which contains non-english data in cql-filter, GeoServer returns no data. My webpage has following meta, as well:
When i check geoserver log, i see some messy characters instead of my non-english string in cql-filter.
Answer
So Answer is (All credit goes to to Ben Caradoc-Davies and GeoServer mailing list. Thanks them):
Adding URIEncoding="UTF-8" or useBodyEncodingForURI ="true" to server.xml was the right solution for Tomcat 7. Also, upgrading to Tomcat 8 solves everything without a need to add above codes.
According to this link, "In Tomcat 8 starting with 8.0.0 (8.0.0-RC3, to be specific), default value (strict compliance is off) of URIEncoding is now UTF-8."
Lesson to be learned: As a end-user, always use some recent versions but not exactly latest one. I had another experience of problem with Tomcat some time ago. After searching a lot, I understood that it is because of some new feature in Tomcat, and so, there is no document for problem available or a solution.
No comments:
Post a Comment