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:

  1. i'm aware of file_charset setting change encoding, changes html , sql encodings , not viable solution.
  2. i've checked django docs seems cannot set either template or context encoding on per-file basis, assumed 'utf-8' or whatever file_charset is.
  3. searched google & ideas. no luck.
  4. 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

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -