[GRASS-SVN] r54249 - grass/branches/develbranch_6/gui/wxpython/core

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Dec 8 05:29:01 PST 2012


Author: martinl
Date: 2012-12-08 05:29:01 -0800 (Sat, 08 Dec 2012)
New Revision: 54249

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


Modified: grass/branches/develbranch_6/gui/wxpython/core/gcmd.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/core/gcmd.py	2012-12-08 13:26:59 UTC (rev 54248)
+++ grass/branches/develbranch_6/gui/wxpython/core/gcmd.py	2012-12-08 13:29:01 UTC (rev 54249)
@@ -76,10 +76,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
 
@@ -93,10 +92,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
 
@@ -466,9 +464,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 ''
@@ -710,3 +707,5 @@
     
     Debug.msg(1, "GetSystemEncoding(): %s" % enc)
     return enc
+
+_enc = GetDefaultEncoding() # define as global variable



More information about the grass-commit mailing list