<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body style="word-wrap:break-word" fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div style="direction: ltr;">
<div><font size="3" style="color: rgb(0, 0, 0);">Hmmm... Nice backwards compatibility ESRI. The +'s seem to still be quite legal (</font><font size="3"><a href="http://tools.ietf.org/html/rfc3986" target="_blank">http://tools.ietf.org/html/rfc3986</a> and other
 references) in the query string (but not the path). I don't have access to test and I'm guessing these ideas won't work but they might be worth a quick try:</font></div>
<div style="color: rgb(0, 0, 0);"><font size="3"><br>
</font></div>
<div style="color: rgb(0, 0, 0);"><font size="3">  1) Try encoding the wms_name in the metadata: "wms_name" "Topomap%20DRG%20250k"</font></div>
<div style="color: rgb(0, 0, 0);"><font size="3">  2) Don't set the wms_name in the metadata but add it to the connection: CONNECTION "http://ndgishub.nd.gov/arcgis/services/All_Elevation/MapServer/WMSServer?LAYERS=Topomap%20DRG%20250k&"</font></div>
<div style="color: rgb(0, 0, 0);"><font size="3"><br>
</font></div>
<div><font size="3" style="color: rgb(0, 0, 0);">I'm betting MapServer will encode the %'s in 1 and throw an error in 2. Otherwise you could hack the MapServer source. Function is called msEncodeUrlExcept() in mapstring.c you can see the section to change starting
 at line 1138 in git master (</font><font size="3"><a href="https://github.com/mapserver/mapserver/blob/master/mapstring.c)." target="_blank">https://github.com/mapserver/mapserver/blob/master/mapstring.c)</a></font></div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><font size="3"><br>
</font></div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma;"><font size="3">Maybe it's worth making this change as part of 7.0?</font></div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma;"><font size="3"><br>
</font></div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma;"><font size="3">Steve</font></div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><font size="3"><br>
</font></div>
<br>
<div style="color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: 16px;">
<hr tabindex="-1">
<div id="divRpF434791" style="direction:ltr"><font face="Tahoma" size="2" color="#000000"><b>From:</b> mapserver-users-bounces@lists.osgeo.org [mapserver-users-bounces@lists.osgeo.org] on behalf of Moen, Paul T. [pmoen@nd.gov]<br>
<b>Sent:</b> Tuesday, August 19, 2014 4:56 PM<br>
<b>To:</b> mapserver-users@lists.osgeo.org<br>
<b>Subject:</b> [mapserver-users] WMS request fails when spaces are encoded as plus symbol in query part of URL<br>
</font><br>
</div>
<div></div>
<div>
<div>Hi all,</div>
<div><br>
</div>
<div>We are consuming WMS services hosted by ESRI ArcGIS Server 10.0.  The server was upgraded to ArcGIS Server 10.2.2 and we no longer can access layer names with spaces.</div>
<div><br>
</div>
<div>This is the server’s capabilities.</div>
<div>http://ndgishub.nd.gov/arcgis/services/All_Elevation/MapServer/WMSServer?request=GetCapabilities&service=WMS</div>
<div><br>
</div>
<div>This is the layer I am using.</div>
<div><br>
</div>
<div>
<div>LAYER</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span># DEBUG 5</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>CONNECTIONTYPE WMS</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>CONNECTION "http://ndgishub.nd.gov/arcgis/services/All_Elevation/MapServer/WMSServer?"</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>METADATA</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>"wms_name" "Topomap DRG 250k"</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>"wms_format" "image/png"</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>"wms_server_version" "1.1.1"</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>"wms_srs" "EPSG:2266"</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>END</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>TYPE RASTER</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>STATUS OFF</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>NAME "USGS DRG 250k Topo Maps"</div>
<div>END</div>
</div>
<div><br>
</div>
<div>Mapserver encodes this request as follows.  Notice that the layer name, which is ‘Topomap DRG 250k’, is encoded with the spaces becoming the ‘+’ character.</div>
<div><br>
</div>
<div>http://ndgishub.nd.gov/arcgis/services/All_Elevation/MapServer/WMSServer?LAYERS=Topomap+DRG+250k&REQUEST=map&WMTVER=1.0.0&SERVICE=WMS&FORMAT=image/png&STYLES=&HEIGHT=1146&SRS=EPSG:2266&WIDTH=1271&BBOX=1906240.15992838,596656.333359479,2119730.85012732,789150.692893686&TRANSPARENT=TRUE&EXCEPTIONS=INIMAGE</div>
<div><br>
</div>
<div>This returns the error in an image that says “Parameter ‘layers’ contains unacceptable layer names.”</div>
<div><br>
</div>
<div>When I replace the + in the layer name with %20, LAYERS=Topomap+DRG+250k become LAYERS=Topomap%20DRG%20250k and the request becomes the following.</div>
<div><br>
</div>
<div>http://ndgishub.nd.gov/arcgis/services/All_Elevation/MapServer/WMSServer?LAYERS=Topomap%20DRG%20250k&REQUEST=map&WMTVER=1.0.0&SERVICE=WMS&FORMAT=image/png&STYLES=&HEIGHT=1146&SRS=EPSG:2266&WIDTH=1271&BBOX=1906240.15992838,596656.333359479,2119730.85012732,789150.692893686&TRANSPARENT=TRUE&EXCEPTIONS=INIMAGE</div>
<div><br>
</div>
<div>That request works.  Obviously, ESRI is no longer decoding + as a space and therefore does not recognize the layer name with spaces.  </div>
<div><br>
</div>
<div>Is there any way I can have mapserver encode all characters using percent-encoding, or at least encode spaces as %20 instead of a + character.</div>
<div><br>
</div>
<div>Thanks,</div>
<div>
<div>
<div><br>
</div>
<span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; border-spacing: 0px;"><span class="Apple-style-span" style="font-family:Calibri,sans-serif; font-size:14px"><span class="Apple-style-span" style="font-family:Calibri">Paul
 Moen</span><span class="Apple-style-span" style="font-family:Calibri"><br>
</span><span class="Apple-style-span" style="font-family:Calibri"><a href="mailto:pmoen@nd.gov" style="color:blue" target="_blank">pmoen@nd.gov</a></span><span class="Apple-style-span" style="font-family:Calibri"><br>
</span><span class="Apple-style-span" style="font-family:Calibri">701-328-2434</span></span><br>
<br>
</span></div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>