UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' json json

UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9'


OK now I fixed it. In the head of your views.py, put this interpreter

# -*- coding: latin-1 -*-

Then in your function,

name = 'Hervé'name.decode('latin-1').encode('ascii','xmlcharrefreplace') //add this linejsondict['success'] = Truejsondict['text']['welcome'] = 'Bienvenue, %s!' % name