Fixed non-ASCII output.
authorMartin Vidner <martin@vidner.net>
Mon, 5 Oct 2009 04:26:46 +0000 (5 06:26 +0200)
committerMartin Vidner <martin@vidner.net>
Mon, 5 Oct 2009 04:26:46 +0000 (5 06:26 +0200)
Thanks to Mokawi for the report:
http://mvidner.blogspot.com/2009/08/cnetworkmanager-021.html?showComment=1254554339823#c5041769288765573270
Pending problems:
 The table formatting is not right (counting bytes, not columns).
 It probably still breaks with non-UTF-8 environments.

dbusclient/__init__.py
nm-mock

index 5d338e0..a795234 100644 (file)
@@ -30,6 +30,7 @@ class DBusMio(dbus.proxies.ProxyObject):
 
     API_OPTIONS = {
         "byte_arrays": True,
+        "utf8_strings": True,
         }
 
     def __init__(self, conn=None, bus_name=None, object_path=None, introspect=True, follow_name_owner_changes=False, **kwargs):
diff --git a/nm-mock b/nm-mock
index c1e002b..16c4850 100755 (executable)
--- a/nm-mock
+++ b/nm-mock
@@ -1,4 +1,5 @@
 #!/usr/bin/python
+# -*- coding: utf-8 -*-
 
 # TODO: adapt nm lib to connect to session bus too, and try this mock
 
@@ -83,7 +84,8 @@ class ConnectionMock(DBusMock):
     def GetSettings(self):
         return {
             "connection": {
-                "id": "mockid",
+                # testing non-ASCII output: str vs unicode
+                "id": "moje síť", # "my net"
                 "type": "mocktype"
                 },
             "section1": {