From f7f708225fc0f9553c5cbf3ad57d4bbf69a9f0b2 Mon Sep 17 00:00:00 2001 From: prculley Date: Thu, 30 Jun 2016 11:40:54 -0500 Subject: [PATCH 1/2] Bug 9552 Web Family tree export should be utf-8 --- gramps/plugins/export/exportftree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gramps/plugins/export/exportftree.py b/gramps/plugins/export/exportftree.py index 0659b26e0..9dc2132e1 100644 --- a/gramps/plugins/export/exportftree.py +++ b/gramps/plugins/export/exportftree.py @@ -121,7 +121,7 @@ class FtreeWriter: id_map[key] = n id_name[key] = get_name(pn, sn, count) - with open(self.filename,"w") as f: + with open(self.filename, "w", encoding='utf_8') as f: for key in self.plist: self.update() From a879d0e48591c058b07a9fdbbb089d04615faf77 Mon Sep 17 00:00:00 2001 From: prculley Date: Sat, 16 Jul 2016 16:22:43 -0500 Subject: [PATCH 2/2] bug 9552 Export to '.wft' file crashes if Unicode characters are present on Windows --- data/tests/exp_sample.wft | 44 +++++++++++++++++++++++++++++ gramps/plugins/test/test_exports.py | 10 +++++++ 2 files changed, 54 insertions(+) create mode 100644 data/tests/exp_sample.wft diff --git a/data/tests/exp_sample.wft b/data/tests/exp_sample.wft new file mode 100644 index 000000000..622244fed --- /dev/null +++ b/data/tests/exp_sample.wft @@ -0,0 +1,44 @@ +Anna Hansdotter;;;;;2/10/1864-29/9/1945 +Keith Lloyd Smith;Lloyd Smith;Janis Green;;;11/8/1966 +Hans Peter Smith;Gustaf Smith;Anna Hansdotter;;;17/4/1904-29/1/1977 +Hanna Smith;Martin Smith0;Elna Jefferson;;;29/1/1821 +Herman Julius Nielsen;;;;;31/8/1889-1945 +Evelyn Michaels;;;;;1897 +Marjorie Lee Smith;Hjalmar Smith0;Marjorie Ohman;;;4/11/1934 +Gus Smith;Gustaf Smith;Anna Hansdotter;;;11/9/1897-21/10/1963 +Jennifer Anderson;;;;;5/11/1907-29/5/1985 +Lillie Harriet Jones;;;;;2/5/1910-26/6/1990 +John Hjalmar Smith;Hjalmar Smith0;Marjorie Ohman;;;30/1/1932 +Eric Lloyd Smith;Lloyd Smith;Janis Green;;;28/8/1963 +Amber Marie Smith;Edwin Smith;Janice Adams;;;12/4/1998 +Carl Emil Smith;Gustaf Smith;Anna Hansdotter;;;20/12/1899-28/1/1959 +Hjalmar Smith;Gustaf Smith;Anna Hansdotter;;;31/1/1893-25/9/1894 +Martin Smith;Martin Smith0;Elna Jefferson;;;19/11/1830-1899 +Astrid Shermanna Augusta Smith;Gustaf Smith;Anna Hansdotter;;;31/1/1889-21/12/1963 +Gustaf Smith, Sr.;Martin Smith;Kerstina Hansdotter;;;28/11/1862-23/7/1930 +Marta Ericsdotter;;;;;1775 +Kirsti Marie Smith;Gustaf Smith;Anna Hansdotter;;;15/12/1886-18/7/1966 +Ingeman Smith;;;;;1770 +Anna Streiffert;;;;;23/9/1860-2/2/1927 +Craig Peter Smith;Lloyd Smith;Janis Green;;;1966 +Magnes Smith;Martin Smith;Kerstina Hansdotter;;;6/10/1858-20/2/1910 +Janice Ann Adams;;;;;26/8/1965 +Marjorie Ohman;;;;;3/6/1903-22/6/1980 +Darcy Horne;;;;;2/7/1966 +Lloyd Smith;Hans Smith;Lillie Jones;;;13/3/1935 +Alice Paula Perkins;;;;;22/11/1933 +Lars Peter Smith;Eric Smith;Darcy Horne;;;16/9/1991 +Elna Jefferson;;;;;14/9/1800- +Edwin Michael Smith;John Smith;Alice Perkins;;;24/5/1961 +Kerstina Hansdotter;;;;;29/11/1832-1908 +Martin Smith0;Ingeman Smith;Marta Ericsdotter;;;1794- +Ingeman Smith0;Martin Smith0;Elna Jefferson;;;29/1/1826 +Marjorie Alice Smith0;John Smith;Alice Perkins;;;5/2/1960 +Janis Elaine Green;;;;;2/12/1935 +Mason Michael Smith;Edwin Smith;Janice Adams;;;26/6/1996 +Edwin Willard;;;;;1886 +Ingar Smith;Martin Smith0;Elna Jefferson;;;1823 +Hjalmar Smith0;Gustaf Smith;Anna Hansdotter;;;7/4/1895-26/6/1975 +Emil Smith;Martin Smith;Kerstina Hansdotter;;;27/9/1860 +雪 Ke 柯;Herman Nielsen;Astrid Smith;;; +ピーター リチミシキスイミ;;;;; diff --git a/gramps/plugins/test/test_exports.py b/gramps/plugins/test/test_exports.py index 6f5d26b8b..b21199101 100644 --- a/gramps/plugins/test/test_exports.py +++ b/gramps/plugins/test/test_exports.py @@ -223,5 +223,15 @@ class ExportControl(unittest.TestCase): if msg: self.fail(tst_file + ': ' + msg) + def test_wft(self): + """ Run a Web Family Tree export test """ + set_format(0) # Use ISO date for test + config.set('preferences.place-auto', True) + src_file = 'exp_sample.gramps' + tst_file = 'exp_sample.wft' + msg = do_it(src_file, tst_file) + if msg: + self.fail(tst_file + ': ' + msg) + if __name__ == "__main__": unittest.main()