UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 1: ordinal not in range(128)
问题 I know there is existing title about this, but there question is different from mine. So here's my problem. I use context processor to display user name. It's working but my sentry detect an error yesterday. UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 1: ordinal not in range(128) Here is my code: def display_name(request): try: name = "{0} {1}".format(request.user.first_name, request.user.last_name) name = name.strip() if not name: name = request.user.username