[Qgis-user] QGIS Python Plugin Installer not UTF-8 aware?

Borys Jurgiel borys at wolf.most.org.pl
Mon Nov 17 13:35:51 PST 2008


Monday 17 of November 2008 11:59:00 Andreas Neumann napisał(a):
> It seems like the Python QGIS Plugin installer has problems displaying
> UTF-8 characters.
>
> As an example I am using german umlauts in the plugin description which is
> not displayed correctly.
>
> I filed bug https://trac.osgeo.org/qgis/ticket/1405
>
> This may be related to https://trac.osgeo.org/qgis/changeset/9617 ?
>
> Thank you for having a look at this bug.
>
> Andreas

Andreas, Installer seems to be ok. If you see wrong characters, probably your 
description is not unicoded. Check your __init__.py file, because probably 
you've wrote:

def description():
  return 'Danke schön'

This string is recognized by Python as iso8859-1 (the encoding declaration in 
the first line of the file doesn't matter). If you want tu use unicode, you 
need to use the following code instead:

def description():
  return u'Danke schön'


However... Installer do, but rest of QGIS doesn't support utf-8 in plugin 
metadata ;) So I suggest to use simple iso8859-1 strings now:

# -*- coding: iso8859-1 -*-
(...)
def description():
  return 'Danke schön'
(...)

And of course don't forget to save it in 8859-1.

Regards,
B.



More information about the Qgis-user mailing list