Fixed #29817 -- Deprecated settings.FILE_CHARSET.

This commit is contained in:
Jon Dufresne 2018-10-02 20:45:19 -07:00 committed by Tim Graham
parent 99d4fc18bd
commit 0cd465b63a
8 changed files with 83 additions and 12 deletions

View file

@ -613,8 +613,7 @@ the :ref:`i18n documentation <how-to-create-language-files>` for details.
This command doesn't require configured settings. However, when settings aren't
configured, the command can't ignore the :setting:`MEDIA_ROOT` and
:setting:`STATIC_ROOT` directories or include :setting:`LOCALE_PATHS`. It will
also write files in UTF-8 rather than in :setting:`FILE_CHARSET`.
:setting:`STATIC_ROOT` directories or include :setting:`LOCALE_PATHS`.
.. django-admin-option:: --all, -a

View file

@ -1424,7 +1424,12 @@ attempt.
Default: ``'utf-8'``
The character encoding used to decode any files read from disk. This includes
template files and initial SQL data files.
template files, static files, and translation catalogs.
.. deprecated:: 2.2
This setting is deprecated. Starting with Django 3.1, files read from disk
must be UTF-8 encoded.
.. setting:: FILE_UPLOAD_HANDLERS
@ -3374,7 +3379,6 @@ Error reporting
File uploads
------------
* :setting:`DEFAULT_FILE_STORAGE`
* :setting:`FILE_CHARSET`
* :setting:`FILE_UPLOAD_HANDLERS`
* :setting:`FILE_UPLOAD_MAX_MEMORY_SIZE`
* :setting:`FILE_UPLOAD_PERMISSIONS`

View file

@ -265,12 +265,11 @@ Use strings when creating templates manually::
from django.template import Template
t2 = Template('This is a string template.')
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 :setting:`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. (:setting:`FILE_CHARSET`
is set to ``'utf-8'`` by default.)
But the common case is to read templates from the filesystem. If your template
files are not stored with a UTF-8 encoding, adjust the :setting:`TEMPLATES`
setting. The built-in :py:mod:`~django.template.backends.django` backend
provides the ``'file_charset'`` option to change the encoding used to read
files from disk.
The :setting:`DEFAULT_CHARSET` setting controls the encoding of rendered templates.
This is set to UTF-8 by default.