[geneagrapher] 09/226: Changed text encoding from iso-8859-1 to utf-8 to expand set of characters supported.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Sat Jul 11 17:10:31 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository geneagrapher.

commit df82affe5dbbc94c9f570f2d2814067d47b3629f
Author: David Alber <alber.david at gmail.com>
Date:   Sun Apr 27 07:45:55 2008 +0000

    Changed text encoding from iso-8859-1 to utf-8 to expand set of characters supported.
---
 src/GGraph.py | 10 +++++-----
 src/tests.py  | 24 ++++++++++++++++++------
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/src/GGraph.py b/src/GGraph.py
index 9ad4f06..1123fef 100644
--- a/src/GGraph.py
+++ b/src/GGraph.py
@@ -82,14 +82,14 @@ class Node:
     def __str__(self):
         if self.record.hasInstitution():
             if self.record.hasYear():
-                return self.record.name.encode('iso-8859-1', 'replace') + ' \\n' + self.record.institution.encode('iso-8859-1', 'replace') + ' (' + str(self.record.year) + ')'
+                return self.record.name.encode('utf-8', 'replace') + ' \\n' + self.record.institution.encode('utf-8', 'replace') + ' (' + str(self.record.year) + ')'
             else:
-                return self.record.name.encode('iso-8859-1', 'replace') + ' \\n' + self.record.institution.encode('iso-8859-1', 'replace')
+                return self.record.name.encode('utf-8', 'replace') + ' \\n' + self.record.institution.encode('utf-8', 'replace')
         else:
             if self.record.hasYear():
-                return self.record.name.encode('iso-8859-1', 'replace') + ' \\n(' + str(self.record.year) + ')'
+                return self.record.name.encode('utf-8', 'replace') + ' \\n(' + str(self.record.year) + ')'
             else:
-                return self.record.name.encode('iso-8859-1', 'replace')
+                return self.record.name.encode('utf-8', 'replace')
 
     def __cmp__(self, n2):
         return self.record.__cmp__(n2.record)
@@ -183,7 +183,7 @@ class Graph:
         dotfile = ""
         
         dotfile += """digraph genealogy {
-    graph [charset="iso-8859-1"];
+    graph [charset="utf-8"];
     node [shape=plaintext];
     edge [style=bold];\n\n"""
 
diff --git a/src/tests.py b/src/tests.py
index 14b9a75..06e8119 100644
--- a/src/tests.py
+++ b/src/tests.py
@@ -221,7 +221,7 @@ class TestGraphMethods(unittest.TestCase):
     def test012_generate_dot_file(self):
         # Test the generateDotFile() method.
         dotfileexpt = """digraph genealogy {
-    graph [charset="iso-8859-1"];
+    graph [charset="utf-8"];
     node [shape=plaintext];
     edge [style=bold];
 
@@ -243,7 +243,7 @@ class TestGraphMethods(unittest.TestCase):
         graph.addNode("Otto Mencke", "Universitaet Leipzig", 1665, 21235, [])
         
         dotfileexpt = """digraph genealogy {
-    graph [charset="iso-8859-1"];
+    graph [charset="utf-8"];
     node [shape=plaintext];
     edge [style=bold];
 
@@ -340,6 +340,18 @@ class TestGrabberMethods(unittest.TestCase):
         self.assertEquals(institution, None)
         self.assertEquals(year, None)
         self.assertEquals(advisors, [])
+
+    # Tests for special (from my point of view) characters:
+    def test008_slash_l(self):
+        # Test the extractNodeInformation() method for a record
+        # containing a slash l character. Example:
+        # http://www.genealogy.math.ndsu.nodak.edu/id.php?id=7383.
+        grabber = grab.Grabber(7383)
+        [name, institution, year, advisors] = grabber.extractNodeInformation()
+        self.assertEquals(name, u"W\u0142adys\u0142aw Hugo Dyonizy Steinhaus")
+        self.assertEquals(institution, u"Georg-August-Universit\xe4t G\xf6ttingen")
+        self.assertEquals(year, 1911)
+        self.assertEquals(advisors, [7298])
         
 class TestGeneagrapherMethods(unittest.TestCase):
     """
@@ -384,9 +396,9 @@ class TestGeneagrapherMethods(unittest.TestCase):
 
 if __name__ == '__main__':
     suite = unittest.TestSuite()
-    #suite.addTest(unittest.makeSuite(TestRecordMethods))
-    #suite.addTest(unittest.makeSuite(TestNodeMethods))
-    #suite.addTest(unittest.makeSuite(TestGraphMethods))
+    suite.addTest(unittest.makeSuite(TestRecordMethods))
+    suite.addTest(unittest.makeSuite(TestNodeMethods))
+    suite.addTest(unittest.makeSuite(TestGraphMethods))
     suite.addTest(unittest.makeSuite(TestGrabberMethods))
     suite.addTest(unittest.makeSuite(TestGeneagrapherMethods))
-    unittest.TextTestRunner(verbosity=1).run(suite)
\ No newline at end of file
+    unittest.TextTestRunner(verbosity=1).run(suite)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/geneagrapher.git



More information about the debian-science-commits mailing list