Ticket #11624: render_to_kmz_encoding_fix.diff

File render_to_kmz_encoding_fix.diff, 682 bytes (added by jbronn, 15 years ago)

Encode the KML as a bytestring using DEFAULT_CHARSET.

  • django/contrib/gis/shortcuts.py

     
    11import cStringIO, zipfile
     2from django.conf import settings
    23from django.http import HttpResponse
    34from django.template import loader
    45
     
    67    "Returns compressed KMZ from the given KML string."
    78    kmz = cStringIO.StringIO()
    89    zf = zipfile.ZipFile(kmz, 'a', zipfile.ZIP_DEFLATED)
    9     zf.writestr('doc.kml', kml)
     10    zf.writestr('doc.kml', kml.encode(settings.DEFAULT_CHARSET))
    1011    zf.close()
    1112    kmz.seek(0)
    1213    return kmz.read()
Back to Top