1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

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

@@ -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.