So my QA guy is putting an app through the ringer and presented me with the following error on a page:

Caught UnicodeEncodeError while rendering: ('ascii', u'Utf8-\u010a\u010e\ufffd"\u0117', 5, 8, 'ordinal not in range(128)')

For some reason I thought UTF8 characters Just Worked™ in Django, but that was a bad assumption. The problem came from my model’s __unicode__ def:

def __unicode__(self):
    return " ".join([self.first_name, self.last_name])

Luckily Django provides a simple fix for this problem.

from django.utils.encoding import smart_unicode
...
def __unicode__(self):
    return smart_unicode(" ".join([self.first_name, self.last_name]))