Skip to content

Instantly share code, notes, and snippets.

@douglasmiranda
Created July 27, 2012 19:02
Show Gist options
  • Save douglasmiranda/3189843 to your computer and use it in GitHub Desktop.
Save douglasmiranda/3189843 to your computer and use it in GitHub Desktop.
Python UnicodeEncodeError: 'ascii' codec can't encode character
# https://groups.google.com/forum/?fromgroups#!topic/django-brasil/TZBXSowifn8
from django.utils.encoding import smart_str, smart_unicode
a = u'\xa1'
print smart_str(a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment