maposmatic-dev
[Top][All Lists]
Advanced

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

[Maposmatic-dev] [PATCH] Allows to fill the csv output with unicode data


From: David Decotigny
Subject: [Maposmatic-dev] [PATCH] Allows to fill the csv output with unicode data
Date: Sat, 12 Sep 2009 00:40:36 +0200

Up to now, the csv data was encoded into ascii. Now, it's encoded in
UTF-8, allowing to correctly store unicode street names. Also adds a
copyright notice.
---
 ocitysmap/street_index.py |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/ocitysmap/street_index.py b/ocitysmap/street_index.py
index ef1bc83..e32c56b 100644
--- a/ocitysmap/street_index.py
+++ b/ocitysmap/street_index.py
@@ -533,15 +533,16 @@ class OCitySMap:
                 l.warning('error while opening destination file %s: %s'
                           % (output_filename, ex))
             else:
+                copyright_notice = (u'© 2009 MapOSMatic/ocitysmap authors. '
+                                    u'Map data © 2009 OpenStreetMap.org '
+                                    u'and contributors 
(CC-BY-SA)').encode('UTF-8')
                 if title is not None:
-                    writer.writerow(['#', title.encode('latin1',  'replace'),
-                                     'ISO-8859-1'])
+                    writer.writerow(['# (UTF-8)', title.encode('UTF-8'), 
copyright_notice])
                 else:
-                    writer.writerow(['#', 'MapOSMatic', 'ISO-8859-1'])
+                    writer.writerow(['# (UTF-8)', '', copyright_notice])
 
                 for street in self.streets:
-                    s = [e.encode('latin1', 'replace') for e in street]
-                    writer.writerow(s)
+                    writer.writerow([e.encode('UTF-8') for e in street])
             return
 
         if file_type in ('png', 'png24'):
-- 
1.6.0.4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]