Opened 12 years ago

Closed 10 years ago

#2946 closed enhancement (invalid)

HttpResponse should set charset for mimetypes starting with 'text/'

Reported by: dummy@… Owned by: nobody
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I came across this point during doing some Ajax related responses with return mostly text/xml in utf-8. If I create HttpResponse(data, mimetype='text/xml') the default charset won't be set by django. Instead I have to call it HttpResponse(data, mimetype='text/xml; charset=\'utf-8\) which is not the right way in my opinion.

Attachments (1)

django-http-mimetype.diff (743 bytes) - added by dummy@… 12 years ago.
make charset set for mimetypes starting with 'text/'

Download all attachments as: .zip

Change History (3)

Changed 12 years ago by dummy@…

Attachment: django-http-mimetype.diff added

make charset set for mimetypes starting with 'text/'

comment:1 Changed 11 years ago by Simon G. <dev@…>

Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 10 years ago by Jacob

Resolution: invalid
Status: newclosed

Automatically setting the charset is dangerous since Django shouldn't be guessing about what you're trying to review. If you're returning text/*, you do need to think about charsets and handle them yourself.

Note: See TracTickets for help on using tickets.
Back to Top