From ae9ceb17e0b97089948314f477bc859b0e0ebd81 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 3 Aug 2002 03:44:00 +0000 Subject: [PATCH] ReadGedcom importing improvements svn: r1104 --- gramps/src/gramps.py | 1 - gramps/src/gramps_main.py | 1 + gramps/src/latin_utf8.py | 2 +- gramps/src/plugins/ReadGedcom.py | 13 +++++++++---- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gramps/src/gramps.py b/gramps/src/gramps.py index 346d6bf5b..0aca4ad7a 100755 --- a/gramps/src/gramps.py +++ b/gramps/src/gramps.py @@ -30,7 +30,6 @@ import sys # GNOME/GTK libraries # #------------------------------------------------------------------------- -import GdkImlib import gtk import gnome.ui import gnome.config diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index 710ec8c3e..b83c3e81f 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -960,6 +960,7 @@ class Gramps: self.remove_from_person_list(p1,old_id) self.remove_from_person_list(p2) self.redisplay_person_list(p1) + self.update_display(0) def on_delete_parents_clicked(self,obj): if not self.active_parents: diff --git a/gramps/src/latin_utf8.py b/gramps/src/latin_utf8.py index 6791634b6..fa1eac682 100644 --- a/gramps/src/latin_utf8.py +++ b/gramps/src/latin_utf8.py @@ -22,7 +22,7 @@ import sys if sys.version[0] != '1': def utf8_to_latin(s): - return s.encode('latin-1','replace') + return s.encode('iso-8859-1','replace') def latin_to_utf8(s): return s diff --git a/gramps/src/plugins/ReadGedcom.py b/gramps/src/plugins/ReadGedcom.py index 9bc77e67f..849c62e8e 100644 --- a/gramps/src/plugins/ReadGedcom.py +++ b/gramps/src/plugins/ReadGedcom.py @@ -195,6 +195,8 @@ class GedcomParser: self.trans = string.maketrans('','') self.delc = self.trans[0:31] + + self.trans2 = self.trans[0:127] + ('?' * 128) self.file_obj = window.get_widget("file") self.encoding_obj = window.get_widget("encoding") @@ -261,11 +263,14 @@ class GedcomParser: def get_next(self): if self.backoff == 0: - next_line = self.f.readline() - if next_line == '': + next_line = string.strip(self.f.readline()) + self.text = string.translate(next_line,self.trans,self.delc) + if self.text == '': raise UNEXPECTED_EOF - self.text = self.cnv(string.strip(next_line)) - self.text = string.translate(self.text,self.trans,self.delc) + try: + self.text = self.cnv(self.text) + except: + self.text = string.translate(self.text,self.trans2) self.index = self.index + 1 l = string.split(self.text, None, 2)