From 8ad83d32b78226a0f685624b6b1f59d0b7ad893e Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 5 Feb 2004 19:53:02 +0000 Subject: [PATCH] * src/plugins/soundgen.py: Fall back to empty input. svn: r2779 --- gramps2/ChangeLog | 1 + gramps2/src/plugins/soundgen.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index f40d15b95..26829d026 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,6 +1,7 @@ 2004-02-05 Alex Roitman * src/plugins/Merge.py (gen_key,name_compare): Fall back to not using soundex if the charset can't be latin-1 encoded. + * src/plugins/soundgen.py: Fall back to empty input. 2004-02-05 Michel Guitel * doc/gramps-manual/fr/cmdline.xml: Update. diff --git a/gramps2/src/plugins/soundgen.py b/gramps2/src/plugins/soundgen.py index 358ee105f..0bdd80fa4 100644 --- a/gramps2/src/plugins/soundgen.py +++ b/gramps2/src/plugins/soundgen.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2003 Donald N. Allingham +# Copyright (C) 2000-2004 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -75,14 +75,22 @@ class SoundGen: if active_person: n = active_person.getPrimaryName().getSurname() self.name.set_text(n) - self.value.set_text(soundex.soundex(n)) + try: + se_text = soundex.soundex(n) + except UnicodeEncodeError: + se_text = soundex.soundex('') + self.value.set_text(se_text) else: self.name.set_text("") self.glade.get_widget("soundEx").show() def on_apply_clicked(self,obj): - self.value.set_text(soundex.soundex(unicode(obj.get_text()))) + try: + se_text = soundex.soundex(unicode(obj.get_text())) + except UnicodeEncodeError: + se_text = soundex.soundex('') + self.value.set_text(se_text) #------------------------------------------------------------------------- #