diff options
author | Simon Law <simon.law@ecometrica.com> | 2012-08-30 14:12:26 -0400 |
---|---|---|
committer | Simon Law <simon.law@ecometrica.com> | 2012-08-30 14:12:26 -0400 |
commit | ef5678ce4ff518b7e3dfbda87563b7ffac6d7816 (patch) | |
tree | 3ca8da9b1df4cf30e3b5470aec8d196e8ee03629 /wkhtmltopdf/utils.py | |
parent | 0aa9bd310e5d66a76a109174f12885d0629861a3 (diff) | |
download | django-wkhtmltopdf-ef5678ce4ff518b7e3dfbda87563b7ffac6d7816.tar.gz django-wkhtmltopdf-ef5678ce4ff518b7e3dfbda87563b7ffac6d7816.tar.bz2 django-wkhtmltopdf-ef5678ce4ff518b7e3dfbda87563b7ffac6d7816.zip |
Pass --encoding utf8 to wkhtmltopdf to render Unicode characters to PDF.
Since we PDFTemplateResponse renders templates, and Django uses UTF-8
to do the rendering, we can safely assume that the result is in
UTF-8.
Diffstat (limited to 'wkhtmltopdf/utils.py')
-rw-r--r-- | wkhtmltopdf/utils.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/wkhtmltopdf/utils.py b/wkhtmltopdf/utils.py index 99998a2..8e0caef 100644 --- a/wkhtmltopdf/utils.py +++ b/wkhtmltopdf/utils.py @@ -71,6 +71,9 @@ def wkhtmltopdf(pages, output=None, **kwargs): options = copy(options) options.update(kwargs) + # Force --encoding utf8 unless the user has explicitly overridden this. + options.setdefault('encoding', 'utf8') + env = getattr(settings, 'WKHTMLTOPDF_ENV', None) if env is not None: env = dict(os.environ, **env) |