elpaso / qgis-geocoding

QGIS Python geocoding and reverse geocoding plugin
http://www.itopen.it/2009/06/05/geocoding-qgis-plugins-released/
24 stars 17 forks source link

Error using non - ascii characters in geocoding #4

Closed bvthomsen closed 11 years ago

bvthomsen commented 12 years ago

I've encountered an error when using the Geocoding plugin ver. 2.3 in QGIS ver. 1.8 If you specify an address containing a non-ascii character - one which returns several candidates - and choose one of the candidate addresses, You'll get an error:

"An error has occured while executing Python code:

Traceback (most recent call last): File "C:/Users/Bo Victor Thomsen/.qgis//python/plugins\GeoCoding\GeoCoding.py", line 233, in geocode point = places[str(place_dlg.placesComboBox.currentText())] UnicodeEncodeError: 'ascii' codec can't encode character u'\xc5' in position 0: ordinal not in range(128)

Python version: 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]

QGIS version: 1.8.0-Lisboa Lisboa, 6416f38 " The test-address was "Åbrinken"

After a little bit of Google - digging (I know absolutely zilch about Python) I changed the following lines in GeoCoding.py:

233 point = places[str(place_dlg.placesComboBox.currentText())] 234 self.process_point(str(place_dlg.placesComboBox.currentText()), point)

to:

233 point = places[unicode(place_dlg.placesComboBox.currentText())] 234 self.process_point(unicode(place_dlg.placesComboBox.currentText()), point)

after which the error disappeared.