Search code examples
djangoviewasciiencoding

Django ascii displaying error


Ascii decoding error

Text = "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."

I saved the text into MYSQL table to novarchar column, it inserts successfully.

when i retrieve this data in console, it is displaying correctly. But when i tried to retrieve it via django and display it in template ,it is showing as some ascii characters.

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


Solution

  • I guess you miss the content type meta tag in your template:

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