[OpenLayers-Users] WMS layer request does not use UTF-8?

Chris Green chris.green at ibstv.co.uk
Thu Apr 7 03:09:20 EDT 2011


Hi All

 

I am developing an application that takes place names from a database and
brings up a map of local features. The user’s choice of location results in
a WMS request for a map which is generated server side via PHP Mapscript and
Mapserver. 

 

I am using an OL WMS layer which is set up as:

 

searchLayer = new OpenLayers.Layer.WMS(city + "WMS search",

       "http://localhost/searchWMS.php?searchString=" + searchString +
"&service=WMS&version=1.1.1&Request=GetMap",

       {transparent:'true', layers:['location']},{singleTile:'true'});

 

This works fine for all search locations that do not contain accented
characters, but does not work when there are accented characters present
because it seems that the OL WMS request  is not using the UTF-8 character
set. As an example, the location “Andalucía” is sent by OL as :

 

 

http://localhost/searchWMS.php?searchString=Andaluc%EDa
&service=WMS&version=1.1.1&Request=GetMap&TRANSPARENT=true&LAYERS=location&S
TYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fpng&SRS=EP
SG%3A900913&_OLSALT=0.07736280351154812&BBOX=-28350000,-15525000,28350000,15
525000&WIDTH=1260&HEIGHT=690

 

 

On the other hand if I pass the same location as a separate request, not
part of the WMS request, it gets sent to the server using UTF-8 as:

 

http://localhost/test_search.php?searchString=Andaluc%C3%ADa

 

This is recognised by my database and works fine. 

 

 

I have been trying to figure out a way to force WMS layer to use UTF-8 when
sending requests, without success so far (I am using OL 2.8) Does anyone
know of a solution to this problem?

 

 

Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110407/b0e84ee3/attachment-0001.html


More information about the Users mailing list