GeoLabs / QgsWPSClient

WPS Client Plugin for QGIS
Other
1 stars 1 forks source link

UnicodeDecodeError #1

Open adrienandrem opened 8 years ago

adrienandrem commented 8 years ago

Using the plugin, i get a UnicodeDecodeError. Here is the displayed error message:

Traceback (most recent call last): File "/home/aandre/.qgis2/python/plugins/QgsWPSClient/wpslib/executionresult.py", line 135, in resultHandler self.parseResult(resultXML) File "/home/aandre/.qgis2/python/plugins/QgsWPSClient/wpslib/executionresult.py", line 240, in parseResult pystring(QApplication.translate("QgsWps", "WPS Error: ")+str(e))) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 23: ordinal not in range(128)

Version de Python : 2.7.6 (default, Jun 22 2015, 18:01:27) [GCC 4.8.2]

Version de QGIS : 2.8.1-Wien Wien, exported

How may i debug this?

gfenoy commented 8 years ago

I suppose that your exception message (the e variable) is in french.

From the tests I have made locally with python, I can see the following behavior: 1) str("Héhé") 'H\xc3\xa9h\xc3\xa9'

2) unicode(str("Héhé")) Traceback (most recent call last): File "", line 1, in UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)

3) unicode(str("Héhé").decode("utf-8")) u'H\xe9h\xe9'

So I suppose that if you replace the original:

pystring(QApplication.translate("QgsWps", "WPS Error: ")+str(e)))

by

pystring(QApplication.translate("QgsWps", "WPS Error: ")+str(e).decode("utf-8")))

it may work.

I hope you can tell me if it solves your issue or not.