[Django] #29817: Deprecate FILE_CHARSET setting

4 views
Skip to first unread message

Django

unread,
Oct 3, 2018, 12:53:48 AM10/3/18
to django-...@googlegroups.com
#29817: Deprecate FILE_CHARSET setting
------------------------------------------------+------------------------
Reporter: Jon Dufresne | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Other) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
The setting was introduced in
[https://github.com/django/django/commit/953badbea5a04159adbfa970f5805c0232b6a401
953badbea5a04159adbfa970f5805c0232b6a401].

It looks as `settings.FILE_CHARSET` is no longer necessary and could
easily be deprecated. Its existence is
[https://docs.djangoproject.com/en/dev/ref/unicode/#templates justified
as]:

> But the common case is to read templates from the filesystem, and this
creates a slight complication: not all filesystems store their data
encoded as UTF-8. If your template files are not stored with a UTF-8
encoding, set the FILE_CHARSET setting to the encoding of the files on
disk. When Django reads in a template file, it will convert the data from
this encoding to Unicode.

Which seems suspect to me. I'm not aware of any modern environment that
can't UTF-8 encode files to disk.

Its use is extremely limited in the code. After removal, we could instead
document that files must be encoded using UTF-8.

Much like `DEFAULT_CONTENT_TYPE`, this setting doesn't play well with
third-party libraries. If a project were to use this setting, it might be
unable to load templates from third-party libraries that used the default
UTF-8 encoding.

Further, this setting is entirely untested.

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

Django

unread,
Oct 3, 2018, 12:58:15 AM10/3/18
to django-...@googlegroups.com
#29817: Deprecate FILE_CHARSET setting
-------------------------------------+-------------------------------------

Reporter: Jon Dufresne | Owner: nobody
Type: | Status: new
Cleanup/optimization |

Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jon Dufresne):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/10472 PR]

Additionally, there was some discussion of this in
[https://github.com/django/django/pull/10428#discussion_r219679706
PR#10428] which motivated this work.

--
Ticket URL: <https://code.djangoproject.com/ticket/29817#comment:1>

Django

unread,
Oct 3, 2018, 3:48:14 AM10/3/18
to django-...@googlegroups.com
#29817: Deprecate FILE_CHARSET setting
-------------------------------------+-------------------------------------
Reporter: Jon Dufresne | Owner: nobody
Type: | Status: new
Cleanup/optimization |

Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

This would be nice. Django-developers thread asking for input:
https://groups.google.com/d/topic/django-developers/7bZbYVV6hg4/discussion
— lets see if there are any issues raised.

--
Ticket URL: <https://code.djangoproject.com/ticket/29817#comment:2>

Django

unread,
Oct 3, 2018, 4:13:34 AM10/3/18
to django-...@googlegroups.com
#29817: Deprecate FILE_CHARSET setting
-------------------------------------+-------------------------------------
Reporter: Jon Dufresne | Owner: nobody
Type: | Status: closed
Cleanup/optimization |

Component: Core (Other) | Version: master
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* status: new => closed
* resolution: => wontfix


Comment:

Initial feedback on the thread is that this probably **IS** needed. I'm
going to close as `wontfix` on that basis, but **happy to reopen** if the
discussion develops there.

--
Ticket URL: <https://code.djangoproject.com/ticket/29817#comment:3>

Django

unread,
Oct 4, 2018, 3:38:26 AM10/4/18
to django-...@googlegroups.com
#29817: Deprecate FILE_CHARSET setting
-------------------------------------+-------------------------------------
Reporter: Jon Dufresne | Owner: nobody
Type: | Status: closed
Cleanup/optimization |

Component: Core (Other) | Version: master
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

So the discussion evolve such that it looks like the only issue here would
be enforcing the use of UTF-8 in editors (for template files etc).

Is that something we want to do? (Not, as yet, answers on the thread re
that.)

--
Ticket URL: <https://code.djangoproject.com/ticket/29817#comment:4>

Django

unread,
Oct 4, 2018, 3:54:31 AM10/4/18
to django-...@googlegroups.com
#29817: Deprecate FILE_CHARSET setting
-------------------------------------+-------------------------------------
Reporter: Jon Dufresne | Owner: nobody
Type: | Status: new
Cleanup/optimization |

Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* status: closed => new
* resolution: wontfix =>


--
Ticket URL: <https://code.djangoproject.com/ticket/29817#comment:5>

Django

unread,
Oct 10, 2018, 9:52:36 AM10/10/18
to django-...@googlegroups.com
#29817: Deprecate FILE_CHARSET setting
--------------------------------------+------------------------------------

Reporter: Jon Dufresne | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | 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):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/29817#comment:6>

Django

unread,
Oct 15, 2018, 5:34:41 PM10/15/18
to django-...@googlegroups.com
#29817: Deprecate FILE_CHARSET setting
--------------------------------------+------------------------------------
Reporter: Jon Dufresne | Owner: nobody
Type: Cleanup/optimization | Status: closed

Component: Core (Other) | Version: master
Severity: Normal | Resolution: fixed
Keywords: | 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@…>):

* status: new => closed

* resolution: => fixed


Comment:

In [changeset:"0cd465b63aa7c03a3d14bd5fd6543628d585f8da" 0cd465b]:
{{{
#!CommitTicketReference repository=""
revision="0cd465b63aa7c03a3d14bd5fd6543628d585f8da"
Fixed #29817 -- Deprecated settings.FILE_CHARSET.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29817#comment:7>

Django

unread,
Sep 10, 2019, 6:19:59 AM9/10/19
to django-...@googlegroups.com
#29817: Deprecate FILE_CHARSET setting
--------------------------------------+------------------------------------
Reporter: Jon Dufresne | Owner: nobody
Type: Cleanup/optimization | Status: closed

Component: Core (Other) | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"3d716467a9f046c7af4fb62c13e6b975c06c135f" 3d716467]:
{{{
#!CommitTicketReference repository=""
revision="3d716467a9f046c7af4fb62c13e6b975c06c135f"
Refs #29817 -- Removed settings.FILE_CHARSET per deprecation timeline.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29817#comment:8>

Reply all
Reply to author
Forward
0 new messages