[orca/gnome-3-6] Fix for bug 681892 - More UnicodeDecodeErrors



commit e328497d1b41333b5b7aff231b5c9878d402b57b
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Sep 3 16:26:31 2012 -0400

    Fix for bug 681892 - More UnicodeDecodeErrors

 src/orca/keybindings.py |    5 +++++
 src/orca/keynames.py    |    5 ++++-
 2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/keybindings.py b/src/orca/keybindings.py
index 733b802..ed27210 100644
--- a/src/orca/keybindings.py
+++ b/src/orca/keybindings.py
@@ -225,6 +225,11 @@ class KeyBinding:
             keysym = keysym.replace('KP_', _('keypad ')).title()
         string = '%s%s %s' % (mods, keysym, clickCount)
 
+        try:
+            string = string.encode("UTF-8")
+        except UnicodeDecodeError:
+            pass
+
         return string.strip()
 
 class KeyBindings:
diff --git a/src/orca/keynames.py b/src/orca/keynames.py
index ccd2188..dc91e7d 100644
--- a/src/orca/keynames.py
+++ b/src/orca/keynames.py
@@ -346,6 +346,9 @@ def localizeKeySequence(keys):
             keyName = keyName.encode("UTF-8")
         except UnicodeDecodeError:
             pass
-        keys = keys.replace(key, keyName)
+        try:
+            keys = keys.replace(key, keyName)
+        except UnicodeDecodeError:
+            pass
 
     return keys



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]