Bug report #17418

UnicodeEncodeError when trying to create new layer with spatial index in DB manager

Added by Johannes Kroeger about 7 years ago. Updated almost 6 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:DB Manager
Affected QGIS version:2.18.14 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:25315

Description

I tried to upload a layer to PostGIS in the DB Manager and got the following error:

UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 5: ordinal not in range(128) 
Traceback (most recent call last):
  File "/usr/share/qgis/python/plugins/db_manager/dlg_import_vector.py", line 375, in accept
    self.db.connector.createSpatialIndex((schema, table), geom)
  File "/usr/share/qgis/python/plugins/db_manager/db_plugins/postgis/connector.py", line 966, in createSpatialIndex
    idx_name = self.quoteId(u"sidx_%s_%s" % (tablename, geom_column))
  File "/usr/share/qgis/python/plugins/db_manager/db_plugins/connector.py", line 193, in quoteId
    identifier) if identifier is not None else str()  # make sure it's python unicode string
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 5: ordinal not in range(128)

Python version: 2.7.14 (default, Sep 20 2017, 01:25:59) [GCC 7.2.0] 
QGIS version: 2.18.13 Las Palmas, exported

To reproduce:

Try to add a layer to PostGIS via DB Manager where the "Table" name has a non-ascii character (like "ä") and tick the "Create spatial index" option.

History

#1 Updated by Giovanni Manghi about 7 years ago

  • Affected QGIS version changed from 2.18.13 to 2.18.14

Works as expected on master.

#2 Updated by Jürgen Fischer almost 6 years ago

  • Status changed from Open to Feedback

Please test with QGIS 3.4 - QGIS 2.18 reached it's end of life.

#3 Updated by Alexander Bruy almost 6 years ago

  • Resolution set to no timely feedback
  • Status changed from Feedback to Closed

#4 Updated by Johannes Kroeger almost 6 years ago

  • Resolution changed from no timely feedback to fixed/implemented

Confirming it works fine in QGIS 3.4/3.5.

Also available in: Atom PDF