Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
qgib opened this issue Nov 7, 2017 · 4 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin

Comments

@qgib
Copy link
Contributor

qgib commented Nov 7, 2017

Author Name: Johannes Kroeger (Johannes Kroeger)
Original Redmine Issue: 17418
Affected QGIS version: 2.18.14
Redmine category:db_manager


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.

@qgib
Copy link
Contributor Author

qgib commented Nov 13, 2017

Author Name: Giovanni Manghi (@gioman)


Works as expected on master.


  • version was changed from 2.18.13 to 2.18.14

@qgib
Copy link
Contributor Author

qgib commented Jan 20, 2019

Author Name: Jürgen Fischer (@jef-n)


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


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Feb 13, 2019

Author Name: Alexander Bruy (@alexbruy)


  • resolution was changed from to no timely feedback
  • status_id was changed from Feedback to Closed

@qgib qgib closed this as completed Feb 13, 2019
@qgib
Copy link
Contributor Author

qgib commented Feb 13, 2019

Author Name: Johannes Kroeger (Johannes Kroeger)


Confirming it works fine in QGIS 3.4/3.5.


  • resolution was changed from no timely feedback to fixed/implemented

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin
Projects
None yet
Development

No branches or pull requests

1 participant