planetfederal / qgis-geoserver-plugin

GNU General Public License v2.0
63 stars 52 forks source link

python error when trying import a layer that has a name containing special chars #71

Open gioman opened 7 years ago

gioman commented 7 years ago

tested on master revision code and against GS 2.11

Traceback (most recent call last):
  File "/home/giovanni/.qgis2/python/plugins/geoserverexplorer/gui/explorer.py", line 101, in run
    command(*params)
  File "/home/giovanni/.qgis2/python/plugins/geoserverexplorer/gui/confirm.py", line 20, in publishLayer
    catalog.publishLayer(layer, workspace, True, name)
  File "/home/giovanni/.qgis2/python/plugins/geoserverexplorer/qgis/catalog.py", line 499, in publishLayer
    gslayer = self.catalog.get_layer(name)
  File "/home/giovanni/.qgis2/python/plugins/geoserverexplorer/ext-libs/gsconfig-1.0.6-py2.7.egg/geoserver/catalog.py", line 729, in get_layer
    lyr.fetch()
  File "/home/giovanni/.qgis2/python/plugins/geoserverexplorer/ext-libs/gsconfig-1.0.6-py2.7.egg/geoserver/support.py", line 176, in fetch
    self.dom = self.catalog.get_xml(self.href)
  File "/home/giovanni/.qgis2/python/plugins/geoserverexplorer/geoserver/basecatalog.py", line 143, in get_xml
    raise FailedRequestError("Tried to make a GET request to %s but got a %d status code: \n%s" % (rest_url, response.status, content))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 22: ordinal not in range(128)
gioman commented 7 years ago

@volaya when trying to import a layer (a shapefile for example) that has a name with spaces, then Geoserver Explorer shows a dialog proposing to choose a laundered layer name, in this case with "_" in place of spaces. This would be nice to be done also for special chars replacing the alike of ã é... with a e... Not what should be the drill with characters from languages like arabic, chinese, etc.