[QGIS Commit] r9663 - trunk/qgis/src/python

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Nov 18 07:31:41 EST 2008


Author: wonder
Date: 2008-11-18 07:31:41 -0500 (Tue, 18 Nov 2008)
New Revision: 9663

Modified:
   trunk/qgis/src/python/qgspythonutilsimpl.cpp
Log:
Allow python plugin's metadata in unicode.


Modified: trunk/qgis/src/python/qgspythonutilsimpl.cpp
===================================================================
--- trunk/qgis/src/python/qgspythonutilsimpl.cpp	2008-11-18 07:48:31 UTC (rev 9662)
+++ trunk/qgis/src/python/qgspythonutilsimpl.cpp	2008-11-18 12:31:41 UTC (rev 9663)
@@ -434,6 +434,15 @@
     PyErr_Clear();
     retval = "__error__";
   }
+  else if ( PyUnicode_Check( obj ) )
+  {
+    PyObject* utf8 = PyUnicode_AsUTF8String( obj );
+    if (utf8)
+      retval = QString::fromUtf8( PyString_AS_STRING( utf8 ) );
+    else
+      retval = "__error__";
+    Py_XDECREF( utf8 );
+  }
   else if ( PyString_Check( obj ) )
   {
     retval = PyString_AS_STRING( obj );



More information about the QGIS-commit mailing list