I have a model, "Event", with the following attribute:
desc = models.TextField(blank=True, null=True)
When an instance of the model is saved, it seems to convert special characters to unicode, for example a left double quotation mark becomes "\u201c". Later on, I reference {{ event.desc }} in a template (which works fine), but when I render the template to a string, I get a "UnicodeEncodeError". For context, I am trying to render a simple bit of HTML to a string for posting to an API.
How I render the template:
description = render_to_string('event_description.html', {'event': self})
and the resulting error:
UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in position 845: ordinal not in range(128)
Is there a way to prevent render_to_string from encoding to ascii, or some more appropriate way to prevent this error?