Re: [Django] #10190: Charset should be customizable with HttpResponse

54 views
Skip to first unread message

Django

unread,
Oct 24, 2012, 11:26:51 AM10/24/12
to django-...@googlegroups.com
#10190: Charset should be customizable with HttpResponse
-------------------------------------+-------------------------------------
Reporter: Wonlay | Owner: aaugustin
Type: New feature | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: HttpResponse, | Triage Stage: Fixed on
charset, runtime | a branch
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* owner: ccahoon => aaugustin


--
Ticket URL: <https://code.djangoproject.com/ticket/10190#comment:19>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 21, 2013, 5:15:45 PM9/21/13
to django-...@googlegroups.com
#10190: Charset should be customizable with HttpResponse
-------------------------------------+-------------------------------------
Reporter: Wonlay | Owner: aaugustin
Type: New feature | Status: assigned

Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: HttpResponse, | Triage Stage: Fixed on
charset, runtime | a branch
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/10190#comment:20>

Django

unread,
Sep 21, 2013, 5:15:49 PM9/21/13
to django-...@googlegroups.com
#10190: Charset should be customizable with HttpResponse
-------------------------------------+-------------------------------------
Reporter: Wonlay | Owner:
Type: New feature | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: HttpResponse, | Triage Stage: Fixed on
charset, runtime | a branch
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* status: assigned => new
* owner: aaugustin =>


--
Ticket URL: <https://code.djangoproject.com/ticket/10190#comment:21>

Django

unread,
Nov 14, 2013, 6:34:54 AM11/14/13
to django-...@googlegroups.com
#10190: Charset should be customizable with HttpResponse
-------------------------------------+-------------------------------------
Reporter: Wonlay | Owner:
Type: New feature | unaizalakain
Component: HTTP handling | Status: assigned
Severity: Normal | Version: master
Keywords: HttpResponse, | Resolution:
charset, runtime | Triage Stage: Fixed on
Has patch: 1 | a branch
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by unaizalakain):

* owner: => unaizalakain


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/10190#comment:22>

Django

unread,
Nov 16, 2013, 1:01:28 PM11/16/13
to django-...@googlegroups.com
#10190: Charset should be customizable with HttpResponse
-------------------------------------+-------------------------------------
Reporter: Wonlay | Owner:
Type: New feature | unaizalakain
Component: HTTP handling | Status: assigned
Severity: Normal | Version: master
Keywords: HttpResponse, | Resolution:
charset, runtime | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by unaizalakain):

* stage: Fixed on a branch => Accepted


Comment:

PR sent: https://github.com/django/django/pull/1928

``HttpResponse``s charset is now depending on its ``Content-Type`` header
key.
If no charset is found there, it falls back to the ``DEFAULT_CHARSET``
setting.

--
Ticket URL: <https://code.djangoproject.com/ticket/10190#comment:23>

Django

unread,
Nov 29, 2013, 4:53:30 PM11/29/13
to django-...@googlegroups.com
#10190: Charset should be customizable with HttpResponse
-------------------------------------+-------------------------------------
Reporter: Wonlay | Owner:
Type: New feature | unaizalakain
Component: HTTP handling | Status: assigned
Severity: Normal | Version: master
Keywords: HttpResponse, | Resolution:
charset, runtime | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* needs_better_patch: 0 => 1
* needs_docs: 0 => 1


Comment:

This latest patch doesn't address the fact that Python charsets do not
match IANA-registered character sets. What's your take on this issue?

--
Ticket URL: <https://code.djangoproject.com/ticket/10190#comment:24>

Django

unread,
Dec 1, 2013, 7:38:00 AM12/1/13
to django-...@googlegroups.com
#10190: Charset should be customizable with HttpResponse
-------------------------------------+-------------------------------------
Reporter: Wonlay | Owner:
Type: New feature | unaizalakain
Component: HTTP handling | Status: assigned
Severity: Normal | Version: master
Keywords: HttpResponse, | Resolution:
charset, runtime | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by unaizalakain):

* needs_better_patch: 1 => 0
* needs_docs: 1 => 0


Comment:

For the sake of future readers, this is what we have spoken on IRC
(`#django-dev`):

There are two possible workarounds to this:

- Creating a dictionary between IANA registered charsets and Python
charsets. This would be great but it means having to regularly update and
maintain it.

- Adding a `charset` initialization parameter and property to
`HttpResponse`. If you have issues with the charset specification, just
pass on the charset argument or set the charset property. If not set,
it'll fall back to the extraction from the `Content-Type` response header
and if that isn't possible, to the `DEFAULT_CHARSET` setting.

Finally, we decided for the second solution.

We also spoke about parsing the `Accept-Charset` request header so that
the chain would be:
`[charset parameter/property] ---> [content-type extraction] ---> [accept-
charset extraction] ---> [default setting]`

The problem with it was that the `HttpResponse` object could not possibly
know what the request headers were. It's sad to have this limitation but
there isn't any easy workaround.

So, apart of making the changes suggested in the review, I only added the
charset parameter and property.

--
Ticket URL: <https://code.djangoproject.com/ticket/10190#comment:25>

Django

unread,
Dec 3, 2013, 10:13:12 AM12/3/13
to django-...@googlegroups.com
#10190: Charset should be customizable with HttpResponse
-------------------------------------+-------------------------------------
Reporter: Wonlay | Owner: aaugustin
Type: New feature | Status: assigned
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: HttpResponse, | Triage Stage: Accepted
charset, runtime | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* owner: unaizalakain => aaugustin


Comment:

Tentatively assigning the ticket to myself to review the latest iteration
of the patch.

--
Ticket URL: <https://code.djangoproject.com/ticket/10190#comment:26>

Django

unread,
Dec 12, 2013, 4:30:01 PM12/12/13
to django-...@googlegroups.com
#10190: Charset should be customizable with HttpResponse
-------------------------------------+-------------------------------------
Reporter: Wonlay | Owner: aaugustin
Type: New feature | Status: assigned
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: HttpResponse, | Triage Stage: Accepted
charset, runtime | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by unaizalakain):

Any updates so far?

--
Ticket URL: <https://code.djangoproject.com/ticket/10190#comment:27>

Django

unread,
Dec 13, 2013, 5:50:25 AM12/13/13
to django-...@googlegroups.com
#10190: Charset should be customizable with HttpResponse
-------------------------------------+-------------------------------------
Reporter: Wonlay | Owner: aaugustin
Type: New feature | Status: assigned
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: HttpResponse, | Triage Stage: Accepted
charset, runtime | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by unaizalakain):

* cc: unai@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/10190#comment:28>

Django

unread,
May 10, 2014, 9:17:24 AM5/10/14
to django-...@googlegroups.com
#10190: Charset should be customizable with HttpResponse
-------------------------------------+-------------------------------------
Reporter: Wonlay | Owner:
Type: New feature | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: HttpResponse, | Triage Stage: Accepted
charset, runtime | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* owner: aaugustin =>


* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/10190#comment:29>

Django

unread,
Aug 14, 2014, 7:20:40 AM8/14/14
to django-...@googlegroups.com
#10190: Charset should be customizable with HttpResponse
-------------------------------------+-------------------------------------
Reporter: Wonlay | Owner:
Type: New feature | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: HttpResponse, | Triage Stage: Accepted
charset, runtime | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1

Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


Comment:

I left comments for improvement on the PR. Please uncheck "Patch needs
improvement" when you update it, thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/10190#comment:30>

Django

unread,
Aug 19, 2014, 10:31:59 AM8/19/14
to django-...@googlegroups.com
#10190: Charset should be customizable with HttpResponse
-------------------------------------+-------------------------------------
Reporter: Wonlay | Owner:
Type: New feature | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: HttpResponse, | Triage Stage: Accepted
charset, runtime | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0

Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by unaizalakain):

* needs_better_patch: 1 => 0


Comment:

Comments addressed and PR updated ;-)

--
Ticket URL: <https://code.djangoproject.com/ticket/10190#comment:31>

Django

unread,
Aug 19, 2014, 5:36:51 PM8/19/14
to django-...@googlegroups.com
#10190: Charset should be customizable with HttpResponse
-------------------------------------+-------------------------------------
Reporter: Wonlay | Owner: Tim
Type: New feature | Graham <timograham@…>
Component: HTTP handling | Status: closed
Severity: Normal | Version: master
Keywords: HttpResponse, | Resolution: fixed

charset, runtime | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* owner: => Tim Graham <timograham@…>
* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"5f2542f12a90cfcfb7be776424ef2f7b200df006"]:
{{{
#!CommitTicketReference repository=""
revision="5f2542f12a90cfcfb7be776424ef2f7b200df006"
Fixed #10190 -- Made HttpResponse charset customizable.

Thanks to Simon Charette, Aymeric Augustin, and Tim Graham
for reviews and contributions.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/10190#comment:32>

Reply all
Reply to author
Forward
0 new messages