[Answer]-How to use čćšž in Django?

1👍

The problem is that Django trying to convert non-ASCII character using ASCII table and of course it ends up with error.
To avoid this you can save strings as unicode as follows

var=u"Ra"
string = var + u"č"
return HttpResponse(string)

To use this you have to declare encoding on top of your views.py like this

# –– coding: utf-8 –

Actually you have to declare encoding in each .py file where you are using utf-8 or any other coding instead of default ASCII.
That applies only for Python 2.x because in 3.x stuff saved in utf-8 by default

Leave a comment