python - Override the encoding of a single-file generated from a Django template (not an HTML file) in order to {% ssi %} include parts in latin1? -
i have single template needs encoded in latin1
(to stored in file has transmitted legacy system), whereas other templates should render html pages in utf-8
. template includes, trough {% ssi %}
tags, dynamic documents come legacy system , encoded in latin1
.
if try include documents following error (here complete traceback):
unicodedecodeerror: 'utf-8' codec can't decode byte 0xe9 in position 6426: invalid continuation byte
because of é
char in legacy included file.
what i've tried far:
- i'm aware of
file_charset
setting change encoding, changes html , sql encodings , not viable solution. - i've checked django docs seems cannot set either template or context encoding on per-file basis, assumed '
utf-8
' or whateverfile_charset
is. - searched google & ideas. no luck.
- i may convert encoding later, eventually, error raises inside
template.render()
i've have solve on template loading, think
do proper way exists?
my config is: python 3.4, django 1.8.
Comments
Post a Comment