Opened 18 years ago

Closed 17 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: no UI/UX: no

Description

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@… 18 years ago.
make charset set for mimetypes starting with 'text/'

Download all attachments as: .zip

Change History (3)

by dummy@…, 18 years ago

Attachment: django-http-mimetype.diff added

make charset set for mimetypes starting with 'text/'

comment:1 by Simon G. <dev@…>, 18 years ago

Triage Stage: UnreviewedDesign decision needed

comment:2 by Jacob, 17 years ago

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