[Qgis-developer] Problems with utf-8 in attribute tables

Boehnke, Christian c.boehnke at fugro.de
Wed Jul 8 02:39:28 PDT 2015


Hello,

we try to write non-ASCII characters inside of a QGIS python plugin. There is no problem with the script but with the attribute table, where the characters are not written in utf-8 or sth. else (see attachment). Any suggestions?

Here is an example of our code to fill the attribute table. Row means a list entry which is utf-8 coded.

                               for row in cursor.fetchall():
                                               # add feature
                                               feat = QgsFeature()
                                               feat.setGeometry( QgsGeometry.fromPoint(QgsPoint(row[3], row[4])) )
                                               feat.setAttributes([row[1], row[2], row[3], row[4], self.path, row[0], row[5]])
                                               provider.addFeatures([feat])

Christian Böhnke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150708/80a61ca2/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: utf8.png
Type: image/png
Size: 3317 bytes
Desc: utf8.png
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150708/80a61ca2/attachment-0001.png>


More information about the Qgis-developer mailing list