Opened 8 years ago
Closed 8 years ago
#28271 closed Bug (fixed)
Debug view's AJAX response doesn't have the proper charset
Reported by: | Sergey Tereschenko | Owned by: | |
---|---|---|---|
Component: | Error reporting | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
In django/views/debug.py
technical_500_response
uses content-type text-plain
for ajax requests and text-html
for normal requests.
TECHNICAL_500_TEMPLATE includes meta tag
<meta http-equiv="content-type" content="text/html; charset=utf-8">
And so it supports unicode.
Traceback for AJAX request must use
HttpResponse(text, status=status_code, content_type='text/plain; charset=utf-8')
to support unicode. But now it's just 'text-plain'
Attachments (1)
Change History (6)
by , 8 years ago
Attachment: | 0001-technical_500_response-utf-8-encoding-for-AJAX-reque.patch added |
---|
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Yeah, without charset browser (Chromium at least) displays broken charset.
I can create pull request, and probably, i can add test.
But what should i verify? something like
self.assert(response.content_type, 'text/plain; charset=utf-8')
? Don't know if that will be useful as test case.
comment:3 by , 8 years ago
Needs tests: | set |
---|---|
Summary: | AJAX traceback in DEBUG mode doesn't support unicode → Debug view's AJAX response doesn't have the proper charset |
Triage Stage: | Unreviewed → Accepted |
Yes, I don't think more than a 1 line assertion is needed for the test.
Does the browser misinterpret data without the charset? Maybe you can also add a test in
tests/view_tests/tests/test_debug.py
and send a pull request?