From f90cff165af1ea1ede5cf4679e44735400cd649f Mon Sep 17 00:00:00 2001 From: Simon Law Date: Thu, 23 Aug 2012 11:11:29 -0400 Subject: Fix encoding issues ini PDFTemplateResponse.render_to_temporary_file() --- wkhtmltopdf/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wkhtmltopdf/views.py b/wkhtmltopdf/views.py index fff98c8..741742f 100644 --- a/wkhtmltopdf/views.py +++ b/wkhtmltopdf/views.py @@ -7,6 +7,7 @@ import warnings from django.conf import settings from django.http import HttpResponse from django.template.response import TemplateResponse +from django.utils.encoding import smart_str from django.views.generic import TemplateView from .utils import (content_disposition_filename, override_settings, @@ -86,7 +87,7 @@ class PDFTemplateResponse(TemplateResponse, PDFResponse): # staticfiles app, for instance. with override_settings(**self.get_override_settings()): context = self.resolve_context(self.context_data) - content = template.render(context) + content = smart_str(template.render(context)) tempfile = NamedTemporaryFile(mode=mode, bufsize=bufsize, suffix=suffix, prefix=prefix, -- cgit v1.2.3