Duy Trần Duy Trần - 1 month ago 10x
Python Question

Can not use unicode string in django template

I used "BỘ MÔN TOÁN" string in django template it raised error "'utf8' codec can't decode byte 0xd4 in position 569: invalid continuation byte". But when I use "BO MON TOAN" string, it does'nt raise error. So, I used vietnamese in template and this is my code:

{% extends "site_base.html" %}
{% load i18n %}
{% load staticfiles %}
{% load url from future %}

{% block body_base %}
<div class="subject-box-title">
{% endblock %}

And this is error in my project:
enter image description here

What's happening in my project. Please help me, thanks!


You can define into your HTML tag!

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

and then try to o/p the string.