Django ascii显示错误

时间:2012-07-09 09:48:29

标签: django view asciiencoding

Ascii解码错误

文字= "Hanuman (Sanskrit: हनुमान्, Hanumān), a Hindu deity who was an ardent devotee of Rama according to Hindus legends, and a central character in the Indian epic Ramayana."

我将文本保存到MYSQL表中的novarchar列,它成功插入。

当我在控制台中检索此数据时,它正确显示。但是当我试图通过django检索它并将其显示在模板中时,它显示为一些ascii字符。

显示为"Hanuman (Sanskrit: हनà¥à¤®à¤¾à¤¨à¥, HanumÄn), is a Hindu deity who is an ardent devotee of Rama, a central character in the Indian epic Ramayana."

1 个答案:

答案 0 :(得分:0)

我猜您错过了模板中的内容类型元标记:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />