[PATCH evemu 11/16] python: hardcode the encoding in the two places we need it

Peter Hutterer peter.hutterer at who-t.net
Mon Aug 11 18:34:45 PDT 2014


Prep work for being able to deprecate evemu.const.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 python/evemu/__init__.py | 3 +--
 python/evemu/base.py     | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/python/evemu/__init__.py b/python/evemu/__init__.py
index 0a639c3..f53aa25 100644
--- a/python/evemu/__init__.py
+++ b/python/evemu/__init__.py
@@ -26,7 +26,6 @@ import stat
 import tempfile
 
 import evemu.base
-import evemu.const
 import evemu.event_names
 
 __all__ = ["Device",
@@ -281,7 +280,7 @@ class Device(object):
         Gets the name of the input device (as reported by the device).
         """
         result = self._libevemu.evemu_get_name(self._evemu_device)
-        return result.decode(evemu.const.ENCODING)
+        return result.decode("iso8859-1")
 
     @property
     def id_bustype(self):
diff --git a/python/evemu/base.py b/python/evemu/base.py
index fc66869..5cca150 100644
--- a/python/evemu/base.py
+++ b/python/evemu/base.py
@@ -26,7 +26,7 @@ def raise_error_if(raise_error, result, func, args):
         for (num, arg) in enumerate(func.argtypes):
             # convert args to str for readable output
             if arg == c_char_p:
-                strargs.append('"%s"' % args[num].decode(evemu.const.ENCODING))
+                strargs.append('"%s"' % args[num].decode("iso8859-1"))
             elif arg == c_void_p:
                 strargs.append(hex(int(args[num])))
             else:
-- 
1.9.3



More information about the Input-tools mailing list