[Qgis-user] PythonQT and utf-8 encoding

Andreas Neumann a.neumann at carto.net
Wed Oct 29 07:13:29 EDT 2008

Hello QGIS Developers,

I have a problem with utf-8 encoding when working with python-qt.

UTF-8 works fine within python, but whenever I have to convert it to
QString, I have to call the method QString.fromUtf8()

Is there a more elegant or better solution for using utf-8 strings in
PythonQT, e.g. a global setting at the beginning of the class/file.

I already set the first line in my python script:
# -*- coding: utf-8 -*-

and utf-8 works fine in regular python strings, but not in QStrings.

Thanks for any hint,

Andreas Neumann
Böschacherstrasse 6, CH-8624 Grüt/Gossau, Switzerland
Email: a.neumann at carto.net, Web:
* http://www.carto.net/ (Carto and SVG resources)
* http://www.carto.net/neumann/ (personal page)
* http://www.svgopen.org/ (SVG Open Conference)
* http://www.geofoto.ch/ (Georeferenced Photos of Switzerland)

More information about the Qgis-user mailing list