[GRASS-SVN] r54248 - grass/trunk/gui/wxpython/core

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Dec 8 05:26:59 PST 2012


Author: martinl
Date: 2012-12-08 05:26:59 -0800 (Sat, 08 Dec 2012)
New Revision: 54248

Modified:
   grass/trunk/gui/wxpython/core/gcmd.py
Log:
wxGUI: store default encoding as gcmd._enc variable (used by Encode/Decode string)


Modified: grass/trunk/gui/wxpython/core/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/core/gcmd.py	2012-12-08 13:11:42 UTC (rev 54247)
+++ grass/trunk/gui/wxpython/core/gcmd.py	2012-12-08 13:26:59 UTC (rev 54248)
@@ -69,10 +69,9 @@
     if not string:
         return string
     
-    enc = GetDefaultEncoding()
-    if enc:
-        Debug.msg(5, "DecodeString(): enc=%s" % enc)
-        return string.decode(enc)
+    if _enc:
+        Debug.msg(5, "DecodeString(): enc=%s" % _enc)
+        return string.decode(_enc)
     
     return string
 
@@ -86,10 +85,9 @@
     if not string:
         return string
     
-    enc = GetDefaultEncoding()
-    if enc:
-        Debug.msg(5, "EncodeString(): enc=%s" % enc)
-        return string.encode(enc)
+    if _enc:
+        Debug.msg(5, "EncodeString(): enc=%s" % _enc)
+        return string.encode(_enc)
     
     return string
 
@@ -467,9 +465,8 @@
         
         for type, msg in self.__ProcessStdErr():
             if type == 'ERROR':
-                enc = GetDefaultEncoding()
-                if enc:
-                    return unicode(msg, enc)
+                if _enc:
+                    return unicode(msg, _enc)
                 return msg
         
         return ''
@@ -714,3 +711,5 @@
     
     Debug.msg(1, "GetSystemEncoding(): %s" % enc)
     return enc
+
+_enc = GetDefaultEncoding() # define as global variable



More information about the grass-commit mailing list