Code

Opened 8 years ago

Closed 7 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:

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

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by dummy@…

make charset set for mimetypes starting with 'text/'

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

  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 7 years ago by jacob

  • Resolution set to invalid
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.