[GRASS-SVN] r54253 - grass/branches/develbranch_6/gui/wxpython/dbmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Dec 8 11:36:06 PST 2012


Author: martinl
Date: 2012-12-08 11:36:06 -0800 (Sat, 08 Dec 2012)
New Revision: 54253

Modified:
   grass/branches/develbranch_6/gui/wxpython/dbmgr/vinfo.py
Log:
wxGUI/dbmgr: rewrite unicodeValue()
             (merge r54252 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/dbmgr/vinfo.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/dbmgr/vinfo.py	2012-12-08 19:32:31 UTC (rev 54252)
+++ grass/branches/develbranch_6/gui/wxpython/dbmgr/vinfo.py	2012-12-08 19:36:06 UTC (rev 54253)
@@ -31,17 +31,12 @@
         return value
     
     enc = UserSettings.Get(group = 'atm', key = 'encoding', subkey = 'value')
-    if enc:
-        value = unicode(value, enc)
-    elif 'GRASS_DB_ENCODING' in os.environ:
-        value = unicode(value, os.environ['GRASS_DB_ENCODING'])
+    if not enc and 'GRASS_DB_ENCODING' in os.environ:
+        enc = os.environ['GRASS_DB_ENCODING']
     else:
-        try:
-            value = unicode(value, 'ascii')
-        except UnicodeDecodeError:
-            value = _("Unable to decode value. Set encoding in GUI preferences ('Attributes').")
+        enc = 'ascii'
     
-    return value
+    return unicode(value, enc, errors = 'replace')
 
 def createDbInfoDesc(panel, mapDBInfo, layer):
     """!Create database connection information content"""



More information about the grass-commit mailing list