How to use french letters in django pattern?

I have some french letters (é, è, à ...) in a django template, but when it is loaded by django, a UnicodeDecodeError exception is thrown.

If I do not load the template, but directly use the python string. It is working fine.

Is it possible to use unicode with a django template?

+5
source share
2 answers

You probably store the template in an encoding other than Unicode, for example, Latin-1. I believe that Django assumes that templates in UTF-8 are by default (although there is an option to override this).

UTF-8 (, , ). UTF-8, .

+7

Django unicode, :

" , : , UTF-8. UTF-8, FILE_CHARSET . Django , Unicode. ( FILE_CHARSET " utf-8 ".)

DEFAULT_CHARSET . UTF-8. "

+3

All Articles