python - file not rendering in django template -
i have code supposed render file svn email
command = 'svn cat -r {} "{}{}"'.format(svn_revision, svn_repo, filename) file_content = subprocess.popen(command, shell=true, stdout=subprocess.pipe).stdout.read() context = { 'file_content': file_content, } print file_content email = get_template('file_email/file_email.txt').render(context(context)) print email
the email template (for now) just:
{{file_content|safe}}
- the first print statement dumps file expected.
- the second print statement prints nothing.
- the template rendered, if put words around tag show up.
it happens files (others work fine) , seems encoding problem. notepad++ believes offending files encoded "ucs-2 little endian" whereas ones work "utf-8 without bom".
how can reliably dump file, regardless of encoding, template?
Comments
Post a Comment