开发者

can't encode single quote (') using django's render_to_string

i have a problem with django's render_to_string and encoding single quotes.

... = render_to_string('du开发者_如何学编程mmy.txt', {'request':request, 'text':text,}, context_instance=RequestContext(request)))

why are only these quotes translated to '#39;' and all other special characters not?


Automatic escaping. Link now changed to https://code.djangoproject.com/wiki/AutoEscaping


To get your string in plain letters, you need to unescape it. surround your variable in autoescape off template tag. Something like this

{% autoescape off %}
{{ body }}
{% endautoescape %}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜