[gnome-tweak-tool] be more conservative with unicode errors



commit c32d9457b32d62c88e0be66cc6a5fa0f87d616d1
Author: John Stowers <john stowers gmail com>
Date:   Sat Sep 28 12:15:18 2013 +0200

    be more conservative with unicode errors

 gtweak/tweakmodel.py |    5 +++--
 gtweak/tweakview.py  |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gtweak/tweakmodel.py b/gtweak/tweakmodel.py
index 8179816..cddecf8 100644
--- a/gtweak/tweakmodel.py
+++ b/gtweak/tweakmodel.py
@@ -57,9 +57,10 @@ class Tweak(object):
 
     def search_matches(self, txt):
         if self._search_cache == None:
-            self._search_cache = self.name.decode("utf-8").lower() + " " + 
self.description.decode("utf-8").lower()
+            self._search_cache = self.name.decode("utf-8","ignore").lower() + " " + \
+                                self.description.decode("utf-8","ignore").lower()
             try:
-                self._search_cache += " " + self.extra_info.decode("utf-8").lower()
+                self._search_cache += " " + self.extra_info.decode("utf-8","ignore").lower()
             except:
                 LOG.warning("Error adding search info", exc_info=True)
         return  txt in self._search_cache
diff --git a/gtweak/tweakview.py b/gtweak/tweakview.py
index 2396615..6bac53f 100644
--- a/gtweak/tweakview.py
+++ b/gtweak/tweakview.py
@@ -195,7 +195,7 @@ class Window(Gtk.ApplicationWindow):
             self.listbox.select_row(row)
 
     def _on_search(self, entry):
-        txt = entry.get_text().decode("utf-8").lower()
+        txt = entry.get_text().decode("utf-8","ignore").lower()
         tweaks, group = self._model.search_matches(txt)
         self.show_only_tweaks(tweaks)        
         self._on_list_changed(group)


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