How to make django unicode templates included?
I need help creating django templates with unicode. I am using Django 1.8 with python 2.7 on CENTOS 6.5. MySQL database is created using utf-8. When django displays some templates, I got the error:
UnicodeEncodeError at /
'ascii' codec can't encode character u'\xe9' in position 13: ordinal not in range(128)
Request Method: GET
Request URL: http://bluenanta.com:8000/
Django Version: 1.8.3
Exception Type: UnicodeEncodeError
Exception Value:
'ascii' codec can't encode character u'\xe9' in position 13: ordinal not in range(128)
Exception Location: /home/bluenant/python/lib/python2.7/site- packages/django/utils/encoding.py in force_text, line 94
Python Executable: /home/bluenant/python/bin/python
=====================================
The following code example contains variables that can contain non-ascii strings (for example, image.species}} or {{image.foto}}
{% for image in random_list%}
<li>{% if image.source_url %}
<a href="{{image.source_url}}" target="_blank">{% endif %}
<img src="{{ image.image_url }}" width="150"/>
<br><font size=1px>{{image.id}} {{image.species}} {{image.variance}}
{% if image.form %} forma {{image.form}}{% endif %}<br>
{% if image.foto %} photo: {{image.foto}}{% endif %}
{% if image.source_url %}</a>{% endif %}</font>
</li>
{% endfor %}
+3
source to share
No one has answered this question yet
Check out similar questions: