﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
11624	`render_to_kmz` can't handle non-ascii data	jbronn	jbronn	"So, say you are using the `world` application from the !GeoDjango tutorial ([http://geodjango.org/hg/world/ source here]), and you set up the following view:

{{{
from django.contrib.gis.shortcuts import render_to_kmz
from world.models import WorldBorders

def kmz(request):
    # getting only the Åland Islands, non-ascii character in the name
    qs = WorldBorders.objects.filter(id=142).kml()
    return render_to_kmz('gis/kml/placemarks.kml',
                         { 'places' : qs})

}}}

When trying to visit this view, one gets a `UnicodeEncodeError` instead of a KMZ file.  

Because `ZipFile` objects only accept byte strings, the unicode string from `render_to_kml` needs to be encoded properly.  I assume this should be for what the users has in `settings.DEFAULT_CHARSET`, and the attached patch does that -- but I want to have additional eyes look this over to make sure I'm doing it right. "		closed	GIS	dev		fixed	gis kmz render_to_kmz		Accepted	0	0	0	0	0	0
