render_to: default mimetype lacks '; charset=utf-8'

Issue #8 resolved
Anonymous created an issue

By default, Django describes the charset of HTML pages in the HTTP headers: Content-Type: text/html; charset=utf-8

With render_to, the mimetype is just 'text/html' by default, which means (as a French accents user) I have to redefine mimetype each time I use render_to, which is inconvenient.

I suggest defaulting 'mimetype' to None instead, which is what Django otherwise does (cf. render_to_response source code). This allows to reuse Django's defaults.

Comments (4)

  1. Mikhail Korobov

    Hi all,

    this bug also annoys me because it breaks the WebTest unicode support for views with 'render_to' decorator: without the encoding header WebTest can't reliably predict how to convert the body to unicode and so raises an exception.

    The proposed patch: https://bitbucket.org/kmike/django-annoying/changeset/87eaf62cc812

    I decided not to rename 'mimetype' argument because it is not deprecated officially (see http://docs.djangoproject.com/en/dev/internals/deprecation/ ), renaming it to content_type will break django-annoying backwards compatibility and supporting both names will just complicate code without any benefits.

  2. Log in to comment