On 2015-05-21 13:04, JHeasly wrote:
> I've got a function-based generic view that I want to return a
> utf-16le encoded response (for use as an InDesign tagged text file;
> the utf-16le is what InDesign wants). I've got it working here 
> <https://gist.github.com/jheasly/0f7c53eec6d92905e127>, but am
> wondering if there's an more straightforward way.
> 
> For comparison, the "original" utf-8 encoded version is here 
> <https://gist.github.com/jheasly/e94c8c283b103d954159> and shorter.
> I tried a 
> 
>     response.content.encode('utf-16le')
> 
> as response seems to have some sort of HttpResponse wrapper on it.

you could reduce the verbosity by using render_to_string()

https://docs.djangoproject.com/en/1.7/ref/templates/api/#the-render-to-string-shortcut


but otherwise, I suspect the extras code is just the cost of doing
something off the ordinary path.

-tkc




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20150521152535.162c8d66%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.

Reply via email to