Ticket #11624: render_to_kmz_encoding_fix.diff
File render_to_kmz_encoding_fix.diff, 682 bytes (added by , 15 years ago) |
---|
-
django/contrib/gis/shortcuts.py
1 1 import cStringIO, zipfile 2 from django.conf import settings 2 3 from django.http import HttpResponse 3 4 from django.template import loader 4 5 … … 6 7 "Returns compressed KMZ from the given KML string." 7 8 kmz = cStringIO.StringIO() 8 9 zf = zipfile.ZipFile(kmz, 'a', zipfile.ZIP_DEFLATED) 9 zf.writestr('doc.kml', kml )10 zf.writestr('doc.kml', kml.encode(settings.DEFAULT_CHARSET)) 10 11 zf.close() 11 12 kmz.seek(0) 12 13 return kmz.read()