我如何使用Django和UTF-8内容类型的模板? [英] How do i use Django and UTF-8 content-type for template?
本文介绍了我如何使用Django和UTF-8内容类型的模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我这样做:
return render_to_response()
$ p在Django中$ p>
。如何将内容类型设置为UTF-8?所以显示的东西是UTF-8?
解决方案django使用UTF-8作为默认编码,但可以通过设置进行修改.DEFAULT_CHARSET。
请确保在HTML模板中为HTML页面设置UTF-8:
< meta http-equiv =Content-typecontent =text / html; charset = utf-8/>
When I do:
return render_to_response()
in Django. How do I set the content-type to UTF-8? So that everything displayed is UTF-8?
解决方案django use UTF-8 as default encoding, but this can be modified with settings.DEFAULT_CHARSET.
Be sure, in your HTML template, to set UTF-8 for the HTML page also :
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
这篇关于我如何使用Django和UTF-8内容类型的模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文